コード例 #1
0
/*******************************************************************************
* mvCpuIfPciIfRemap - Set CPU remap register for address windows.
*
* DESCRIPTION:
*
* INPUT:
*       pciTarget   - Peripheral target enumerator. Must be a PCI target.
*       pAddrDecWin - CPU target window information data structure.
*                     Note that caller has to fill in the base field only. The
*                     size field is ignored.
*
* OUTPUT:
*       None.
*
* RETURN:
*       MV_ERROR if target is not a PCI one, MV_OK otherwise.
*
*******************************************************************************/
MV_U32 mvCpuIfPciIfRemap(MV_TARGET pciIfTarget, MV_ADDR_WIN *pAddrDecWin)
{
#if defined(MV_INCLUDE_PEX)
	if (MV_TARGET_IS_PEX(pciIfTarget))
		return mvCpuIfPexRemap(pciIfTarget, pAddrDecWin);

#endif
#if defined(MV_INCLUDE_PCI)

	if (MV_TARGET_IS_PCI(pciIfTarget))
		return mvCpuIfPciRemap(pciIfTarget, pAddrDecWin);
#endif
	return 0;
}
コード例 #2
0
/*******************************************************************************
* mvCpuIfPciRemap - Set CPU remap register for address windows.
*
* DESCRIPTION:
*
* INPUT:
*       pciTarget   - Peripheral target enumerator. Must be a PCI target.
*       pAddrDecWin - CPU target window information data structure.
*                     Note that caller has to fill in the base field only. The
*                     size field is ignored.
*
* OUTPUT:
*       None.
*
* RETURN:
*       MV_ERROR if target is not a PCI one, MV_OK otherwise.
*
*******************************************************************************/
MV_U32 mvCpuIfPciRemap(MV_TARGET pciTarget, MV_ADDR_WIN *pAddrDecWin)
{
	MV_U32 winNum;

	/* Check parameters */
	if (!MV_TARGET_IS_PCI(pciTarget)) {
		mvOsPrintf("mvCpuIfPciRemap: target %d is illegal\n", pciTarget);
		return 0xffffffff;
	}

	/* get the Window number associated with this target */
	winNum = mvAhbToMbusWinTargetGet(pciTarget);

	if (winNum >= MAX_AHB_TO_MBUS_WINS) {
		mvOsPrintf("mvCpuIfPciRemap: mvAhbToMbusWinTargetGet Failed\n");
		return 0xffffffff;
	}

	return mvAhbToMbusWinRemap(winNum, pAddrDecWin);
}
コード例 #3
0
/*******************************************************************************
* mvCpuIfInit - Initialize Controller CPU interface
*
* DESCRIPTION:
*       This function initialize Controller CPU interface:
*       1. Set CPU interface configuration registers.
*       2. Set CPU master Pizza arbiter control according to static
*          configuration described in configuration file.
*       3. Opens CPU address decode windows. DRAM windows are assumed to be
*		   already set (auto detection).
*
* INPUT:
*       None.
*
* OUTPUT:
*       None.
*
* RETURN:
*       None.
*
*******************************************************************************/
MV_STATUS mvCpuIfInit(MV_CPU_DEC_WIN *cpuAddrWinMap)
{
    MV_U32 regVal;
    MV_TARGET target;
    MV_ADDR_WIN addrWin;
    int ii;

    if (cpuAddrWinMap == NULL)
    {
        DB(mvOsPrintf("mvCpuIfInit:ERR. cpuAddrWinMap == NULL\n"));
        return MV_ERROR;
    }

    /* Set ARM Configuration register */
    regVal  = MV_REG_READ(CPU_CONFIG_REG);
    regVal &= ~CPU_CONFIG_DEFAULT_MASK;
    /* regVal |= CPU_CONFIG_DEFAULT; Note: not needed */
    MV_REG_WRITE(CPU_CONFIG_REG,regVal);


    /* First disable all CPU target windows  */
    for (target = 0; cpuAddrWinMap[target].enable != TBL_TERM; target++)
    {
        if ((MV_TARGET_IS_DRAM(target))||(target == INTER_REGS))
        {
            continue;
        }

#if defined(MV_MEM_OVER_PCI_WA) || defined(MV_UART_OVER_PCI_WA)
        /* If the target PEX or PCI and memory is over PEX or PCI we don't touch this CPU windows */
        if (MV_TARGET_IS_PCI(target))
        {
            continue;
        }
#endif

#if defined(MV_MEM_OVER_PEX_WA) || defined(MV_UART_OVER_PEX_WA)
        /* If the target PEX or PCI and memory is over PEX or PCI we don't touch this CPU windows */
        if (MV_TARGET_IS_PEX(target))
        {
            continue;
        }
#endif
#if defined(MV_RUN_FROM_FLASH)
        /* Don't disable the boot device.                               */
        if (target == DEV_BOOCS)
        {
            continue;
        }
#endif /* MV_RUN_FROM_FLASH */
        mvCpuIfTargetWinEnable(MV_CHANGE_BOOT_CS(target),MV_FALSE);
    }

    /* TODO */
    for (ii = 0; ii < 8; ii++)
        MV_REG_WRITE(AHB_TO_MBUS_WIN_CTRL_REG(ii), 0);

#if defined(MV_RUN_FROM_FLASH)
    /* Resize the bootcs windows before other windows, because this     */
    /* window is enabled and will cause an overlap if not resized.      */
    target = DEV_BOOCS;

    if (MV_OK != mvCpuIfTargetWinSet(target, &cpuAddrWinMap[target]))
    {
        DB(mvOsPrintf("mvCpuIfInit:ERR. mvCpuIfTargetWinSet fail\n"));
        return MV_ERROR;
    }

    addrWin.baseLow = cpuAddrWinMap[target].addrWin.baseLow;
    addrWin.baseHigh = cpuAddrWinMap[target].addrWin.baseHigh;
    if (0xffffffff == mvAhbToMbusWinRemap(cpuAddrWinMap[target].winNum ,&addrWin))
    {
        DB(mvOsPrintf("mvCpuIfInit:WARN. mvAhbToMbusWinRemap can't remap winNum=%d\n",
                      cpuAddrWinMap[target].winNum));
    }

#endif /* MV_RUN_FROM_FLASH */

    /* Go through all targets in user table until table terminator			*/
    for (target = 0; cpuAddrWinMap[target].enable != TBL_TERM; target++)
    {

#if defined(MV_RUN_FROM_FLASH)
        if (target == DEV_BOOCS)
        {
            continue;
        }
#endif /* MV_RUN_FROM_FLASH */

        /* if DRAM auto sizing is used do not initialized DRAM target windows, 	*/
        /* assuming this already has been done earlier.							*/
#ifdef	MV_DRAM_AUTO_SIZE
        if (MV_TARGET_IS_DRAM(target))
        {
            continue;
        }
#endif

#if defined(MV_MEM_OVER_PCI_WA) || defined(MV_UART_OVER_PCI_WA)
        /* If the target PEX or PCI and memory is over PEX or PCI we don't touch this CPU windows */
        if (MV_TARGET_IS_PCI(target))
        {
            continue;
        }
#endif

#if defined(MV_MEM_OVER_PEX_WA) || defined(MV_UART_OVER_PEX_WA)
        /* If the target PEX or PCI and memory is over PEX or PCI we don't touch this CPU windows */
        if (MV_TARGET_IS_PEX(target))
        {
            continue;
        }
#endif
        /* If the target attribute is the same as the boot device attribute */
        /* then it's stays disable */
        if (MV_TARGET_IS_AS_BOOT(target))
        {
            continue;
        }

        if((0 == cpuAddrWinMap[target].addrWin.size) ||
                (DIS == cpuAddrWinMap[target].enable))

        {
            if (MV_OK != mvCpuIfTargetWinEnable(target, MV_FALSE))
            {
                DB(mvOsPrintf("mvCpuIfInit:ERR. mvCpuIfTargetWinEnable fail\n"));
                return MV_ERROR;
            }

        }
        else
        {
            if (MV_OK != mvCpuIfTargetWinSet(target, &cpuAddrWinMap[target]))
            {
                DB(mvOsPrintf("mvCpuIfInit:ERR. mvCpuIfTargetWinSet fail\n"));
                return MV_ERROR;
            }

            addrWin.baseLow = cpuAddrWinMap[target].addrWin.baseLow;
            addrWin.baseHigh = cpuAddrWinMap[target].addrWin.baseHigh;
            if (0xffffffff == mvAhbToMbusWinRemap(cpuAddrWinMap[target].winNum ,&addrWin))
            {
                DB(mvOsPrintf("mvCpuIfInit:WARN. mvAhbToMbusWinRemap can't remap winNum=%d\n",
                              cpuAddrWinMap[target].winNum));
            }


        }
    }

#ifdef MV_INCLUDE_PEX
    mvCpuIfEnablePex();
#endif

#ifdef MV_INCLUDE_PMU
    mvCpuIfEnablePmu();
#endif
    return MV_OK;


}
コード例 #4
0
ファイル: mvCpuIf.c プロジェクト: KevinCabana/xpenology
/*******************************************************************************
* mvCpuIfInit - Initialize Controller CPU interface
*
* DESCRIPTION:
*       This function initialize Controller CPU interface:
*       1. Set CPU interface configuration registers.
*       2. Set CPU master Pizza arbiter control according to static
*          configuration described in configuration file.
*       3. Opens CPU address decode windows. DRAM windows are assumed to be
*		   already set (auto detection).
*
* INPUT:
*       None.
*
* OUTPUT:
*       None.
*
* RETURN:
*       None.
*
*******************************************************************************/
MV_STATUS mvCpuIfInit(MV_CPU_DEC_WIN *cpuAddrWinMap)
{
	MV_U32 regVal;
	MV_TARGET target;
	MV_ADDR_WIN addrWin;

	if (cpuAddrWinMap == NULL)
	{
		DB(mvOsPrintf("mvCpuIfInit:ERR. cpuAddrWinMap == NULL\n"));
		return MV_ERROR;
	}

    /*Initialize the boot target array according to device type*/
    if(mvCtrlModelGet() == MV_6180_DEV_ID || mvCtrlModelGet() == MV_6280_DEV_ID)
        sampleAtResetTargetArray = sampleAtResetTargetArray6180P;
    else
        sampleAtResetTargetArray = sampleAtResetTargetArrayP;

	/* Set ARM Configuration register */
	regVal  = MV_REG_READ(CPU_CONFIG_REG);
	regVal &= ~CPU_CONFIG_DEFAULT_MASK;
	regVal |= CPU_CONFIG_DEFAULT;
	MV_REG_WRITE(CPU_CONFIG_REG,regVal);

	/* First disable all CPU target windows  */
	for (target = 0; cpuAddrWinMap[target].enable != TBL_TERM; target++)
    	{
		if ((MV_TARGET_IS_DRAM(target))||(target == INTER_REGS))
		{
			continue;
		}

#if defined(MV_MEM_OVER_PCI_WA) || defined(MV_UART_OVER_PCI_WA)
		/* If the target PEX or PCI and memory is over PEX or PCI we don't touch this CPU windows */
		if (MV_TARGET_IS_PCI(target))
		{
			continue;
		}
#endif

#if defined(MV_MEM_OVER_PEX_WA) || defined(MV_UART_OVER_PEX_WA)
		/* If the target PEX or PCI and memory is over PEX or PCI we don't touch this CPU windows */
		if (MV_TARGET_IS_PEX(target))
		{
			continue;
		}
#endif
#if defined(MV_RUN_FROM_FLASH)
        	/* Don't disable the boot device.                               */
		if (target == DEV_BOOCS)
		{
			continue;
		}
#endif /* MV_RUN_FROM_FLASH */
		/* Only MV88F6282 have 2 PCIe interfaces */
		if((mvCtrlModelGet() != MV_6282_DEV_ID) && MV_TARGET_IS_PEX1(target))
			continue;

		mvCpuIfTargetWinEnable(MV_CHANGE_BOOT_CS(target),MV_FALSE);
	}

#if defined(MV_RUN_FROM_FLASH)
    	/* Resize the bootcs windows before other windows, because this     */
    	/* window is enabled and will cause an overlap if not resized.      */
	target = DEV_BOOCS;

	if (MV_OK != mvCpuIfTargetWinSet(target, &cpuAddrWinMap[target]))
	{
		DB(mvOsPrintf("mvCpuIfInit:ERR. mvCpuIfTargetWinSet fail\n"));
		return MV_ERROR;
	}

	addrWin.baseLow = cpuAddrWinMap[target].addrWin.baseLow;
	addrWin.baseHigh = cpuAddrWinMap[target].addrWin.baseHigh;
	if (0xffffffff == mvAhbToMbusWinRemap(cpuAddrWinMap[target].winNum ,&addrWin))
	{
		DB(mvOsPrintf("mvCpuIfInit:WARN. mvAhbToMbusWinRemap can't remap winNum=%d\n",
					  cpuAddrWinMap[target].winNum));
	}

#endif /* MV_RUN_FROM_FLASH */

	/* Go through all targets in user table until table terminator			*/
	for (target = 0; cpuAddrWinMap[target].enable != TBL_TERM; target++)
    	{

#if defined(MV_RUN_FROM_FLASH)
	if (target == DEV_BOOCS)
	{
		continue;
	}
#endif /* MV_RUN_FROM_FLASH */

	/* if DRAM auto sizing is used do not initialized DRAM target windows, 	*/
	/* assuming this already has been done earlier.							*/
#ifdef	MV_DRAM_AUTO_SIZE
		if (MV_TARGET_IS_DRAM(target))
		{
			continue;
		}
#endif

#if defined(MV_MEM_OVER_PCI_WA) || defined(MV_UART_OVER_PCI_WA)
		/* If the target PEX or PCI and memory is over PEX or PCI we don't touch this CPU windows */
		if (MV_TARGET_IS_PCI(target))
		{
			continue;
		}
#endif

#if defined(MV_MEM_OVER_PEX_WA) || defined(MV_UART_OVER_PEX_WA)
		/* If the target PEX or PCI and memory is over PEX or PCI we don't touch this CPU windows */
		if (MV_TARGET_IS_PEX(target))
		{
			continue;
		}
#endif
	/* If the target attribute is the same as the boot device attribute */
	/* then it's stays disable */
		if (MV_TARGET_IS_AS_BOOT(target))
		{
			continue;
		}
		/* Only MV88F6282 have 2 PCIe interfaces */
		if((mvCtrlModelGet() != MV_6282_DEV_ID) && MV_TARGET_IS_PEX1(target))
			continue;

		if((0 == cpuAddrWinMap[target].addrWin.size) ||
		   (DIS == cpuAddrWinMap[target].enable))

		{
			if (MV_OK != mvCpuIfTargetWinEnable(target, MV_FALSE))
			{
				DB(mvOsPrintf("mvCpuIfInit:ERR. mvCpuIfTargetWinEnable fail\n"));
				return MV_ERROR;
			}

		}
		else
		{
			if (MV_OK != mvCpuIfTargetWinSet(target, &cpuAddrWinMap[target]))
			{
				DB(mvOsPrintf("mvCpuIfInit:ERR. mvCpuIfTargetWinSet fail\n"));
				return MV_ERROR;
			}

			addrWin.baseLow = cpuAddrWinMap[target].addrWin.baseLow;
			addrWin.baseHigh = cpuAddrWinMap[target].addrWin.baseHigh;
			if (0xffffffff == mvAhbToMbusWinRemap(cpuAddrWinMap[target].winNum ,&addrWin))
			{
				DB(mvOsPrintf("mvCpuIfInit:WARN. mvAhbToMbusWinRemap can't remap winNum=%d\n",
							  cpuAddrWinMap[target].winNum));
			}


		}
    }

	return MV_OK;


}