diff options
Diffstat (limited to 'target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family')
44 files changed, 0 insertions, 18708 deletions
diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvLib.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvLib.c deleted file mode 100644 index 5f62784473..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvLib.c +++ /dev/null @@ -1,2513 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include "boardEnv/mvBoardEnvLib.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/sys/mvCpuIf.h" -#include "cpu/mvCpu.h" -#include "cntmr/mvCntmr.h" -#include "gpp/mvGpp.h" -#include "twsi/mvTwsi.h" -#include "pex/mvPex.h" -#include "device/mvDevice.h" -#include "eth/gbe/mvEthRegs.h" - -/* defines */ -/* #define MV_DEBUG */ -#ifdef MV_DEBUG - #define DB(x) x -#else - #define DB(x) -#endif - -extern MV_CPU_ARM_CLK _cpuARMDDRCLK[]; - -#define CODE_IN_ROM MV_FALSE -#define CODE_IN_RAM MV_TRUE - -extern MV_BOARD_INFO* boardInfoTbl[]; -#define BOARD_INFO(boardId) boardInfoTbl[boardId - BOARD_ID_BASE] - -/* Locals */ -static MV_DEV_CS_INFO* boardGetDevEntry(MV_32 devNum, MV_BOARD_DEV_CLASS devClass); - -MV_U32 tClkRate = -1; - - -/******************************************************************************* -* mvBoardEnvInit - Init board -* -* DESCRIPTION: -* In this function the board environment take care of device bank -* initialization. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvBoardEnvInit(MV_VOID) -{ - MV_U32 boardId= mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardEnvInit:Board unknown.\n"); - return; - - } - - /* Set GPP Out value */ - MV_REG_WRITE(GPP_DATA_OUT_REG(0), BOARD_INFO(boardId)->gppOutValLow); - MV_REG_WRITE(GPP_DATA_OUT_REG(1), BOARD_INFO(boardId)->gppOutValHigh); - - /* set GPP polarity */ - mvGppPolaritySet(0, 0xFFFFFFFF, BOARD_INFO(boardId)->gppPolarityValLow); - mvGppPolaritySet(1, 0xFFFFFFFF, BOARD_INFO(boardId)->gppPolarityValHigh); - - /* Workaround for Erratum FE-MISC-70*/ - if(mvCtrlRevGet()==MV_88F6XXX_A0_REV) - { - BOARD_INFO(boardId)->gppOutEnValLow &= 0xfffffffd; - BOARD_INFO(boardId)->gppOutEnValLow |= (BOARD_INFO(boardId)->gppOutEnValHigh) & 0x00000002; - } /*End of WA*/ - - /* Set GPP Out Enable*/ - mvGppTypeSet(0, 0xFFFFFFFF, BOARD_INFO(boardId)->gppOutEnValLow); - mvGppTypeSet(1, 0xFFFFFFFF, BOARD_INFO(boardId)->gppOutEnValHigh); - - /* Nand CE */ - MV_REG_BIT_SET(NAND_CTRL_REG, NAND_ACTCEBOOT_BIT); -} - -/******************************************************************************* -* mvBoardModelGet - Get Board model -* -* DESCRIPTION: -* This function returns 16bit describing board model. -* Board model is constructed of one byte major and minor numbers in the -* following manner: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* String describing board model. -* -*******************************************************************************/ -MV_U16 mvBoardModelGet(MV_VOID) -{ - return (mvBoardIdGet() >> 16); -} - -/******************************************************************************* -* mbBoardRevlGet - Get Board revision -* -* DESCRIPTION: -* This function returns a 32bit describing the board revision. -* Board revision is constructed of 4bytes. 2bytes describes major number -* and the other 2bytes describes minor munber. -* For example for board revision 3.4 the function will return -* 0x00030004. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* String describing board model. -* -*******************************************************************************/ -MV_U16 mvBoardRevGet(MV_VOID) -{ - return (mvBoardIdGet() & 0xFFFF); -} - -/******************************************************************************* -* mvBoardNameGet - Get Board name -* -* DESCRIPTION: -* This function returns a string describing the board model and revision. -* String is extracted from board I2C EEPROM. -* -* INPUT: -* None. -* -* OUTPUT: -* pNameBuff - Buffer to contain board name string. Minimum size 32 chars. -* -* RETURN: -* -* MV_ERROR if informantion can not be read. -*******************************************************************************/ -MV_STATUS mvBoardNameGet(char *pNameBuff) -{ - MV_U32 boardId= mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsSPrintf (pNameBuff, "Board unknown.\n"); - return MV_ERROR; - - } - - mvOsSPrintf (pNameBuff, "%s",BOARD_INFO(boardId)->boardName); - - return MV_OK; -} - -/******************************************************************************* -* mvBoardIsPortInSgmii - -* -* DESCRIPTION: -* This routine returns MV_TRUE for port number works in SGMII or MV_FALSE -* For all other options. -* -* INPUT: -* ethPortNum - Ethernet port number. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE - port in SGMII. -* MV_FALSE - other. -* -*******************************************************************************/ -MV_BOOL mvBoardIsPortInSgmii(MV_U32 ethPortNum) -{ - MV_BOOL ethPortSgmiiSupport[BOARD_ETH_PORT_NUM] = MV_ETH_PORT_SGMII; - - if(ethPortNum >= BOARD_ETH_PORT_NUM) - { - mvOsPrintf ("Invalid portNo=%d\n", ethPortNum); - return MV_FALSE; - } - return ethPortSgmiiSupport[ethPortNum]; -} - -/******************************************************************************* -* mvBoardIsPortInGmii - -* -* DESCRIPTION: -* This routine returns MV_TRUE for port number works in GMII or MV_FALSE -* For all other options. -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE - port in GMII. -* MV_FALSE - other. -* -*******************************************************************************/ -MV_BOOL mvBoardIsPortInGmii(MV_VOID) -{ - MV_U32 devClassId, devClass = 0; - if (mvBoardMppGroupTypeGet(devClass) == MV_BOARD_AUTO) - { - /* Get MPP module ID */ - devClassId = mvBoarModuleTypeGet(devClass); - if (MV_BOARD_MODULE_GMII_ID == devClassId) - return MV_TRUE; - } - else if (mvBoardMppGroupTypeGet(devClass) == MV_BOARD_GMII) - return MV_TRUE; - - return MV_FALSE; -} -/******************************************************************************* -* mvBoardPhyAddrGet - Get the phy address -* -* DESCRIPTION: -* This routine returns the Phy address of a given ethernet port. -* -* INPUT: -* ethPortNum - Ethernet port number. -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit describing Phy address, -1 if the port number is wrong. -* -*******************************************************************************/ -MV_32 mvBoardPhyAddrGet(MV_U32 ethPortNum) -{ - MV_U32 boardId= mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardPhyAddrGet: Board unknown.\n"); - return MV_ERROR; - } - - return BOARD_INFO(boardId)->pBoardMacInfo[ethPortNum].boardEthSmiAddr; -} - -/******************************************************************************* -* mvBoardMacSpeedGet - Get the Mac speed -* -* DESCRIPTION: -* This routine returns the Mac speed if pre define of a given ethernet port. -* -* INPUT: -* ethPortNum - Ethernet port number. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BOARD_MAC_SPEED, -1 if the port number is wrong. -* -*******************************************************************************/ -MV_BOARD_MAC_SPEED mvBoardMacSpeedGet(MV_U32 ethPortNum) -{ - MV_U32 boardId= mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardMacSpeedGet: Board unknown.\n"); - return MV_ERROR; - } - - return BOARD_INFO(boardId)->pBoardMacInfo[ethPortNum].boardMacSpeed; -} - -/******************************************************************************* -* mvBoardLinkStatusIrqGet - Get the IRQ number for the link status indication -* -* DESCRIPTION: -* This routine returns the IRQ number for the link status indication. -* -* INPUT: -* ethPortNum - Ethernet port number. -* -* OUTPUT: -* None. -* -* RETURN: -* the number of the IRQ for the link status indication, -1 if the port -* number is wrong or if not relevant. -* -*******************************************************************************/ -MV_32 mvBoardLinkStatusIrqGet(MV_U32 ethPortNum) -{ - MV_U32 boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardLinkStatusIrqGet: Board unknown.\n"); - return MV_ERROR; - } - - return BOARD_INFO(boardId)->pSwitchInfo[ethPortNum].linkStatusIrq; -} - -/******************************************************************************* -* mvBoardSwitchPortGet - Get the mapping between the board connector and the -* Ethernet Switch port -* -* DESCRIPTION: -* This routine returns the matching Switch port. -* -* INPUT: -* ethPortNum - Ethernet port number. -* boardPortNum - logical number of the connector on the board -* -* OUTPUT: -* None. -* -* RETURN: -* the matching Switch port, -1 if the port number is wrong or if not relevant. -* -*******************************************************************************/ -MV_32 mvBoardSwitchPortGet(MV_U32 ethPortNum, MV_U8 boardPortNum) -{ - MV_U32 boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardSwitchPortGet: Board unknown.\n"); - return MV_ERROR; - } - if (boardPortNum >= BOARD_ETH_SWITCH_PORT_NUM) - { - mvOsPrintf("mvBoardSwitchPortGet: Illegal board port number.\n"); - return MV_ERROR; - } - - return BOARD_INFO(boardId)->pSwitchInfo[ethPortNum].qdPort[boardPortNum]; -} - -/******************************************************************************* -* mvBoardSwitchCpuPortGet - Get the the Ethernet Switch CPU port -* -* DESCRIPTION: -* This routine returns the Switch CPU port. -* -* INPUT: -* ethPortNum - Ethernet port number. -* -* OUTPUT: -* None. -* -* RETURN: -* the Switch CPU port, -1 if the port number is wrong or if not relevant. -* -*******************************************************************************/ -MV_32 mvBoardSwitchCpuPortGet(MV_U32 ethPortNum) -{ - MV_U32 boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardSwitchCpuPortGet: Board unknown.\n"); - return MV_ERROR; - } - - return BOARD_INFO(boardId)->pSwitchInfo[ethPortNum].qdCpuPort; -} - -/******************************************************************************* -* mvBoardIsSwitchConnected - Get switch connection status -* DESCRIPTION: -* This routine returns port's connection status -* -* INPUT: -* ethPortNum - Ethernet port number. -* -* OUTPUT: -* None. -* -* RETURN: -* 1 - if ethPortNum is connected to switch, 0 otherwise -* -*******************************************************************************/ -MV_32 mvBoardIsSwitchConnected(MV_U32 ethPortNum) -{ - MV_U32 boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardIsSwitchConnected: Board unknown.\n"); - return MV_ERROR; - } - - if(ethPortNum >= BOARD_INFO(boardId)->numBoardMacInfo) - { - mvOsPrintf("mvBoardIsSwitchConnected: Illegal port number(%u)\n", ethPortNum); - return MV_ERROR; - } - - if((MV_32)(BOARD_INFO(boardId)->pSwitchInfo)) - return (MV_32)(BOARD_INFO(boardId)->pSwitchInfo[ethPortNum].switchOnPort == ethPortNum); - else - return 0; -} -/******************************************************************************* -* mvBoardSmiScanModeGet - Get Switch SMI scan mode -* -* DESCRIPTION: -* This routine returns Switch SMI scan mode. -* -* INPUT: -* ethPortNum - Ethernet port number. -* -* OUTPUT: -* None. -* -* RETURN: -* 1 for SMI_MANUAL_MODE, -1 if the port number is wrong or if not relevant. -* -*******************************************************************************/ -MV_32 mvBoardSmiScanModeGet(MV_U32 ethPortNum) -{ - MV_U32 boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardSmiScanModeGet: Board unknown.\n"); - return MV_ERROR; - } - - return BOARD_INFO(boardId)->pSwitchInfo[ethPortNum].smiScanMode; -} -/******************************************************************************* -* mvBoardSpecInitGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: Return MV_TRUE and parameters in case board need spesific phy init, -* otherwise return MV_FALSE. -* -* -*******************************************************************************/ - -MV_BOOL mvBoardSpecInitGet(MV_U32* regOff, MV_U32* data) -{ - return MV_FALSE; -} - -/******************************************************************************* -* mvBoardTclkGet - Get the board Tclk (Controller clock) -* -* DESCRIPTION: -* This routine extract the controller core clock. -* This function uses the controller counters to make identification. -* Note: In order to avoid interference, make sure task context switch -* and interrupts will not occure during this function operation -* -* INPUT: -* countNum - Counter number. -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit clock cycles in Hertz. -* -*******************************************************************************/ -MV_U32 mvBoardTclkGet(MV_VOID) -{ - if(mvCtrlModelGet()==MV_6281_DEV_ID) - { -#if defined(TCLK_AUTO_DETECT) - MV_U32 tmpTClkRate = MV_BOARD_TCLK_166MHZ; - - tmpTClkRate = MV_REG_READ(MPP_SAMPLE_AT_RESET); - tmpTClkRate &= MSAR_TCLCK_MASK; - - switch (tmpTClkRate) - { - case MSAR_TCLCK_166: - return MV_BOARD_TCLK_166MHZ; - break; - case MSAR_TCLCK_200: - return MV_BOARD_TCLK_200MHZ; - break; - } -#else - return MV_BOARD_TCLK_200MHZ; -#endif - } - - return MV_BOARD_TCLK_166MHZ; - -} -/******************************************************************************* -* mvBoardSysClkGet - Get the board SysClk (CPU bus clock) -* -* DESCRIPTION: -* This routine extract the CPU bus clock. -* -* INPUT: -* countNum - Counter number. -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit clock cycles in Hertz. -* -*******************************************************************************/ -static MV_U32 mvBoard6180SysClkGet(MV_VOID) -{ - MV_U32 sysClkRate=0; - MV_CPU_ARM_CLK _cpu6180_ddr_l2_CLK[] = MV_CPU6180_DDR_L2_CLCK_TBL; - - sysClkRate = MV_REG_READ(MPP_SAMPLE_AT_RESET); - sysClkRate = sysClkRate & MSAR_CPUCLCK_MASK_6180; - sysClkRate = sysClkRate >> MSAR_CPUCLCK_OFFS_6180; - - sysClkRate = _cpu6180_ddr_l2_CLK[sysClkRate].ddrClk; - - return sysClkRate; - -} - -MV_U32 mvBoardSysClkGet(MV_VOID) -{ -#ifdef SYSCLK_AUTO_DETECT - MV_U32 sysClkRate, tmp, pClkRate, indexDdrRtio; - MV_U32 cpuCLK[] = MV_CPU_CLCK_TBL; - MV_U32 ddrRtio[][2] = MV_DDR_CLCK_RTIO_TBL; - - if(mvCtrlModelGet() == MV_6180_DEV_ID) - return mvBoard6180SysClkGet(); - - tmp = MV_REG_READ(MPP_SAMPLE_AT_RESET); - pClkRate = MSAR_CPUCLCK_EXTRACT(tmp); - pClkRate = cpuCLK[pClkRate]; - - indexDdrRtio = tmp & MSAR_DDRCLCK_RTIO_MASK; - indexDdrRtio = indexDdrRtio >> MSAR_DDRCLCK_RTIO_OFFS; - if(ddrRtio[indexDdrRtio][0] != 0) - sysClkRate = ((pClkRate * ddrRtio[indexDdrRtio][1]) / ddrRtio[indexDdrRtio][0]); - else - sysClkRate = 0; - return sysClkRate; -#else - return MV_BOARD_DEFAULT_SYSCLK; -#endif -} - - -/******************************************************************************* -* mvBoardPexBridgeIntPinGet - Get PEX to PCI bridge interrupt pin number -* -* DESCRIPTION: -* Multi-ported PCI Express bridges that is implemented on the board -* collapse interrupts across multiple conventional PCI/PCI-X buses. -* A dual-headed PCI Express bridge would map (or "swizzle") the -* interrupts per the following table (in accordance with the respective -* logical PCI/PCI-X bridge's Device Number), collapse the INTA#-INTD# -* signals from its two logical PCI/PCI-X bridges, collapse the -* INTA#-INTD# signals from any internal sources, and convert the -* signals to in-band PCI Express messages. 10 -* This function returns the upstream interrupt as it was converted by -* the bridge, according to board configuration and the following table: -* PCI dev num -* Interrupt pin 7, 8, 9 -* A -> A D C -* B -> B A D -* C -> C B A -* D -> D C B -* -* -* INPUT: -* devNum - PCI/PCIX device number. -* intPin - PCI Int pin -* -* OUTPUT: -* None. -* -* RETURN: -* Int pin connected to the Interrupt controller -* -*******************************************************************************/ -MV_U32 mvBoardPexBridgeIntPinGet(MV_U32 devNum, MV_U32 intPin) -{ - MV_U32 realIntPin = ((intPin + (3 - (devNum % 4))) %4 ); - - if (realIntPin == 0) return 4; - else return realIntPin; - -} - -/******************************************************************************* -* mvBoardDebugLedNumGet - Get number of debug Leds -* -* DESCRIPTION: -* INPUT: -* boardId -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_U32 mvBoardDebugLedNumGet(MV_U32 boardId) -{ - return BOARD_INFO(boardId)->activeLedsNumber; -} - -/******************************************************************************* -* mvBoardDebugLeg - Set the board debug Leds -* -* DESCRIPTION: turn on/off status leds. -* Note: assume MPP leds are part of group 0 only. -* -* INPUT: -* hexNum - Number to be displied in hex by Leds. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvBoardDebugLed(MV_U32 hexNum) -{ - MV_U32 val = 0,totalMask, currentBitMask = 1,i; - MV_U32 boardId= mvBoardIdGet(); - - if (BOARD_INFO(boardId)->pLedGppPin == NULL) - return; - - totalMask = (1 << BOARD_INFO(boardId)->activeLedsNumber) -1; - hexNum &= totalMask; - totalMask = 0; - - for (i = 0 ; i < BOARD_INFO(boardId)->activeLedsNumber ; i++) - { - if (hexNum & currentBitMask) - { - val |= (1 << BOARD_INFO(boardId)->pLedGppPin[i]); - } - - totalMask |= (1 << BOARD_INFO(boardId)->pLedGppPin[i]); - - currentBitMask = (currentBitMask << 1); - } - - if (BOARD_INFO(boardId)->ledsPolarity) - { - mvGppValueSet(0, totalMask, val); - } - else - { - mvGppValueSet(0, totalMask, ~val); - } -} - - -/******************************************************************************* -* mvBoarGpioPinGet - mvBoarGpioPinGet -* -* DESCRIPTION: -* -* INPUT: -* class - MV_BOARD_GPP_CLASS enum. -* -* OUTPUT: -* None. -* -* RETURN: -* GPIO pin number. The function return -1 for bad parameters. -* -*******************************************************************************/ -MV_32 mvBoarGpioPinNumGet(MV_BOARD_GPP_CLASS class, MV_U32 index) -{ - MV_U32 boardId, i; - MV_U32 indexFound = 0; - - boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardRTCGpioPinGet:Board unknown.\n"); - return MV_ERROR; - - } - - for (i = 0; i < BOARD_INFO(boardId)->numBoardGppInfo; i++) - if (BOARD_INFO(boardId)->pBoardGppInfo[i].devClass == class) { - if (indexFound == index) - return (MV_U32)BOARD_INFO(boardId)->pBoardGppInfo[i].gppPinNum; - else - indexFound++; - - } - - return MV_ERROR; -} - - -/******************************************************************************* -* mvBoardRTCGpioPinGet - mvBoardRTCGpioPinGet -* -* DESCRIPTION: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* GPIO pin number. The function return -1 for bad parameters. -* -*******************************************************************************/ -MV_32 mvBoardRTCGpioPinGet(MV_VOID) -{ - return mvBoarGpioPinNumGet(BOARD_GPP_RTC, 0); -} - - -/******************************************************************************* -* mvBoardReset - mvBoardReset -* -* DESCRIPTION: -* Reset the board -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None -* -*******************************************************************************/ -MV_VOID mvBoardReset(MV_VOID) -{ - MV_32 resetPin; - - /* Get gpp reset pin if define */ - resetPin = mvBoardResetGpioPinGet(); - if (resetPin != MV_ERROR) - { - MV_REG_BIT_RESET( GPP_DATA_OUT_REG(0) ,(1 << resetPin)); - MV_REG_BIT_RESET( GPP_DATA_OUT_EN_REG(0) ,(1 << resetPin)); - - } - else - { - /* No gpp reset pin was found, try to reset ussing - system reset out */ - MV_REG_BIT_SET( CPU_RSTOUTN_MASK_REG , BIT2); - MV_REG_BIT_SET( CPU_SYS_SOFT_RST_REG , BIT0); - } -} - -/******************************************************************************* -* mvBoardResetGpioPinGet - mvBoardResetGpioPinGet -* -* DESCRIPTION: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* GPIO pin number. The function return -1 for bad parameters. -* -*******************************************************************************/ -MV_32 mvBoardResetGpioPinGet(MV_VOID) -{ - return mvBoarGpioPinNumGet(BOARD_GPP_RESET, 0); -} -/******************************************************************************* -* mvBoardSDIOGpioPinGet - mvBoardSDIOGpioPinGet -* -* DESCRIPTION: -* used for hotswap detection -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* GPIO pin number. The function return -1 for bad parameters. -* -*******************************************************************************/ -MV_32 mvBoardSDIOGpioPinGet(MV_VOID) -{ - return mvBoarGpioPinNumGet(BOARD_GPP_SDIO_DETECT, 0); -} - -/******************************************************************************* -* mvBoardUSBVbusGpioPinGet - return Vbus input GPP -* -* DESCRIPTION: -* -* INPUT: -* int devNo. -* -* OUTPUT: -* None. -* -* RETURN: -* GPIO pin number. The function return -1 for bad parameters. -* -*******************************************************************************/ -MV_32 mvBoardUSBVbusGpioPinGet(MV_32 devId) -{ - return mvBoarGpioPinNumGet(BOARD_GPP_USB_VBUS, devId); -} - -/******************************************************************************* -* mvBoardUSBVbusEnGpioPinGet - return Vbus Enable output GPP -* -* DESCRIPTION: -* -* INPUT: -* int devNo. -* -* OUTPUT: -* None. -* -* RETURN: -* GPIO pin number. The function return -1 for bad parameters. -* -*******************************************************************************/ -MV_32 mvBoardUSBVbusEnGpioPinGet(MV_32 devId) -{ - return mvBoarGpioPinNumGet(BOARD_GPP_USB_VBUS_EN, devId); -} - - -/******************************************************************************* -* mvBoardGpioIntMaskGet - Get GPIO mask for interrupt pins -* -* DESCRIPTION: -* This function returns a 32-bit mask of GPP pins that connected to -* interrupt generating sources on board. -* For example if UART channel A is hardwired to GPP pin 8 and -* UART channel B is hardwired to GPP pin 4 the fuinction will return -* the value 0x000000110 -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* See description. The function return -1 if board is not identified. -* -*******************************************************************************/ -MV_32 mvBoardGpioIntMaskLowGet(MV_VOID) -{ - MV_U32 boardId; - - boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardGpioIntMaskGet:Board unknown.\n"); - return MV_ERROR; - - } - - return BOARD_INFO(boardId)->intsGppMaskLow; -} -MV_32 mvBoardGpioIntMaskHighGet(MV_VOID) -{ - MV_U32 boardId; - - boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardGpioIntMaskGet:Board unknown.\n"); - return MV_ERROR; - - } - - return BOARD_INFO(boardId)->intsGppMaskHigh; -} - - -/******************************************************************************* -* mvBoardMppGet - Get board dependent MPP register value -* -* DESCRIPTION: -* MPP settings are derived from board design. -* MPP group consist of 8 MPPs. An MPP group represent MPP -* control register. -* This function retrieves board dependend MPP register value. -* -* INPUT: -* mppGroupNum - MPP group number. -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit value describing MPP control register value. -* -*******************************************************************************/ -MV_32 mvBoardMppGet(MV_U32 mppGroupNum) -{ - MV_U32 boardId; - - boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardMppGet:Board unknown.\n"); - return MV_ERROR; - - } - - return BOARD_INFO(boardId)->pBoardMppConfigValue[0].mppGroup[mppGroupNum]; -} - - -/******************************************************************************* -* mvBoardMppGroupId - If MPP group type is AUTO then identify it using twsi -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -*******************************************************************************/ -MV_VOID mvBoardMppGroupIdUpdate(MV_VOID) -{ - - MV_BOARD_MPP_GROUP_CLASS devClass; - MV_BOARD_MODULE_ID_CLASS devClassId; - MV_BOARD_MPP_TYPE_CLASS mppGroupType; - MV_U32 devId; - MV_U32 maxMppGrp = 1; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - maxMppGrp = MV_6281_MPP_MAX_MODULE; - break; - case MV_6192_DEV_ID: - maxMppGrp = MV_6192_MPP_MAX_MODULE; - break; - case MV_6190_DEV_ID: - maxMppGrp = MV_6190_MPP_MAX_MODULE; - break; - case MV_6180_DEV_ID: - maxMppGrp = MV_6180_MPP_MAX_MODULE; - break; - } - - for (devClass = 0; devClass < maxMppGrp; devClass++) - { - /* If MPP group can be defined by the module connected to it */ - if (mvBoardMppGroupTypeGet(devClass) == MV_BOARD_AUTO) - { - /* Get MPP module ID */ - devClassId = mvBoarModuleTypeGet(devClass); - if (MV_ERROR != devClassId) - { - switch(devClassId) - { - case MV_BOARD_MODULE_TDM_ID: - case MV_BOARD_MODULE_TDM_5CHAN_ID: - mppGroupType = MV_BOARD_TDM; - break; - case MV_BOARD_MODULE_AUDIO_ID: - mppGroupType = MV_BOARD_AUDIO; - break; - case MV_BOARD_MODULE_RGMII_ID: - mppGroupType = MV_BOARD_RGMII; - break; - case MV_BOARD_MODULE_GMII_ID: - mppGroupType = MV_BOARD_GMII; - break; - case MV_BOARD_MODULE_TS_ID: - mppGroupType = MV_BOARD_TS; - break; - case MV_BOARD_MODULE_MII_ID: - mppGroupType = MV_BOARD_MII; - break; - default: - mppGroupType = MV_BOARD_OTHER; - break; - } - } - else - /* The module bay is empty */ - mppGroupType = MV_BOARD_OTHER; - - /* Update MPP group type */ - mvBoardMppGroupTypeSet(devClass, mppGroupType); - } - - /* Update MPP output voltage for RGMII 1.8V. Set port to GMII for GMII module */ - if ((mvBoardMppGroupTypeGet(devClass) == MV_BOARD_RGMII)) - MV_REG_BIT_SET(MPP_OUTPUT_DRIVE_REG,MPP_1_8_RGMII1_OUTPUT_DRIVE | MPP_1_8_RGMII0_OUTPUT_DRIVE); - else - { - if ((mvBoardMppGroupTypeGet(devClass) == MV_BOARD_GMII)) - { - MV_REG_BIT_RESET(MPP_OUTPUT_DRIVE_REG, BIT7 | BIT15); - MV_REG_BIT_RESET(ETH_PORT_SERIAL_CTRL_1_REG(0),BIT3); - MV_REG_BIT_RESET(ETH_PORT_SERIAL_CTRL_1_REG(1),BIT3); - } - else if ((mvBoardMppGroupTypeGet(devClass) == MV_BOARD_MII)) - { - /* Assumption that the MDC & MDIO should be 3.3V */ - MV_REG_BIT_RESET(MPP_OUTPUT_DRIVE_REG, BIT7 | BIT15); - /* Assumption that only ETH1 can be MII when using modules on DB */ - MV_REG_BIT_RESET(ETH_PORT_SERIAL_CTRL_1_REG(1),BIT3); - } - } - } -} - -/******************************************************************************* -* mvBoardMppGroupTypeGet -* -* DESCRIPTION: -* -* INPUT: -* mppGroupClass - MPP group number 0 for MPP[35:20] or 1 for MPP[49:36]. -* -* OUTPUT: -* None. -* -* RETURN: -* -*******************************************************************************/ -MV_BOARD_MPP_TYPE_CLASS mvBoardMppGroupTypeGet(MV_BOARD_MPP_GROUP_CLASS mppGroupClass) -{ - MV_U32 boardId; - - boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardMppGet:Board unknown.\n"); - return MV_ERROR; - - } - - if (mppGroupClass == MV_BOARD_MPP_GROUP_1) - return BOARD_INFO(boardId)->pBoardMppTypeValue[0].boardMppGroup1; - else - return BOARD_INFO(boardId)->pBoardMppTypeValue[0].boardMppGroup2; -} - -/******************************************************************************* -* mvBoardMppGroupTypeSet -* -* DESCRIPTION: -* -* INPUT: -* mppGroupClass - MPP group number 0 for MPP[35:20] or 1 for MPP[49:36]. -* mppGroupType - MPP group type for MPP[35:20] or for MPP[49:36]. -* -* OUTPUT: -* None. -* -* RETURN: -* -*******************************************************************************/ -MV_VOID mvBoardMppGroupTypeSet(MV_BOARD_MPP_GROUP_CLASS mppGroupClass, - MV_BOARD_MPP_TYPE_CLASS mppGroupType) -{ - MV_U32 boardId; - - boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardMppGet:Board unknown.\n"); - } - - if (mppGroupClass == MV_BOARD_MPP_GROUP_1) - BOARD_INFO(boardId)->pBoardMppTypeValue[0].boardMppGroup1 = mppGroupType; - else - BOARD_INFO(boardId)->pBoardMppTypeValue[0].boardMppGroup2 = mppGroupType; - -} - -/******************************************************************************* -* mvBoardMppMuxSet - Update MPP mux -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -*******************************************************************************/ -MV_VOID mvBoardMppMuxSet(MV_VOID) -{ - - MV_BOARD_MPP_GROUP_CLASS devClass; - MV_BOARD_MPP_TYPE_CLASS mppGroupType; - MV_U32 devId; - MV_U8 muxVal = 0xf; - MV_U32 maxMppGrp = 1; - MV_TWSI_SLAVE twsiSlave; - MV_TWSI_ADDR slave; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - maxMppGrp = MV_6281_MPP_MAX_MODULE; - break; - case MV_6192_DEV_ID: - maxMppGrp = MV_6192_MPP_MAX_MODULE; - break; - case MV_6190_DEV_ID: - maxMppGrp = MV_6190_MPP_MAX_MODULE; - break; - case MV_6180_DEV_ID: - maxMppGrp = MV_6180_MPP_MAX_MODULE; - break; - } - - for (devClass = 0; devClass < maxMppGrp; devClass++) - { - mppGroupType = mvBoardMppGroupTypeGet(devClass); - - switch(mppGroupType) - { - case MV_BOARD_TDM: - muxVal &= ~(devClass ? (0x2 << (devClass * 2)):0x0); - break; - case MV_BOARD_AUDIO: - muxVal &= ~(devClass ? 0x7 : 0x0); /*old Z0 value 0xd:0x0*/ - break; - case MV_BOARD_TS: - muxVal &= ~(devClass ? (0x2 << (devClass * 2)):0x0); - break; - default: - muxVal |= (devClass ? 0xf : 0); - break; - } - } - - /* TWSI init */ - slave.type = ADDR7_BIT; - slave.address = 0; - mvTwsiInit(0, TWSI_SPEED, mvBoardTclkGet(), &slave, 0); - - /* Read MPP module ID */ - DB(mvOsPrintf("Board: twsi exp set\n")); - twsiSlave.slaveAddr.address = mvBoardTwsiExpAddrGet(MV_BOARD_MUX_I2C_ADDR_ENTRY); - twsiSlave.slaveAddr.type = mvBoardTwsiExpAddrTypeGet(MV_BOARD_MUX_I2C_ADDR_ENTRY); - twsiSlave.validOffset = MV_TRUE; - /* Offset is the first command after the address which indicate the register number to be read - in next operation */ - twsiSlave.offset = 2; - twsiSlave.moreThen256 = MV_FALSE; - - - - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &muxVal, 1) ) - { - DB(mvOsPrintf("Board: twsi exp out val fail\n")); - return; - } - DB(mvOsPrintf("Board: twsi exp out val succeded\n")); - - /* Change twsi exp to output */ - twsiSlave.offset = 6; - muxVal = 0; - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &muxVal, 1) ) - { - DB(mvOsPrintf("Board: twsi exp change to out fail\n")); - return; - } - DB(mvOsPrintf("Board: twsi exp change to out succeded\n")); - -} - -/******************************************************************************* -* mvBoardTdmMppSet - set MPPs in TDM module -* -* DESCRIPTION: -* -* INPUT: type of second telephony device -* -* OUTPUT: -* None. -* -* RETURN: -* -*******************************************************************************/ -MV_VOID mvBoardTdmMppSet(MV_32 chType) -{ - - MV_BOARD_MPP_GROUP_CLASS devClass; - MV_BOARD_MPP_TYPE_CLASS mppGroupType; - MV_U32 devId; - MV_U8 muxVal = 1; - MV_U8 muxValMask = 1; - MV_U8 twsiVal; - MV_U32 maxMppGrp = 1; - MV_TWSI_SLAVE twsiSlave; - MV_TWSI_ADDR slave; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - maxMppGrp = MV_6281_MPP_MAX_MODULE; - break; - case MV_6192_DEV_ID: - maxMppGrp = MV_6192_MPP_MAX_MODULE; - break; - case MV_6190_DEV_ID: - maxMppGrp = MV_6190_MPP_MAX_MODULE; - break; - case MV_6180_DEV_ID: - maxMppGrp = MV_6180_MPP_MAX_MODULE; - break; - } - - for (devClass = 0; devClass < maxMppGrp; devClass++) - { - mppGroupType = mvBoardMppGroupTypeGet(devClass); - if(mppGroupType == MV_BOARD_TDM) - break; - } - - if(devClass == maxMppGrp) - return; /* TDM module not found */ - - /* TWSI init */ - slave.type = ADDR7_BIT; - slave.address = 0; - mvTwsiInit(0, TWSI_SPEED, mvBoardTclkGet(), &slave, 0); - - /* Read MPP module ID */ - DB(mvOsPrintf("Board: twsi exp set\n")); - twsiSlave.slaveAddr.address = mvBoardTwsiExpAddrGet(devClass); - twsiSlave.slaveAddr.type = ADDR7_BIT; - twsiSlave.validOffset = MV_TRUE; - /* Offset is the first command after the address which indicate the register number to be read - in next operation */ - twsiSlave.offset = 3; - twsiSlave.moreThen256 = MV_FALSE; - - if(mvBoardIdGet() == RD_88F6281A_ID) - { - muxVal = 0xc; - muxValMask = 0xf3; - } - - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - muxVal = (twsiVal & muxValMask) | muxVal; - - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &muxVal, 1) ) - { - mvOsPrintf("Board: twsi exp out val fail\n"); - return; - } - DB(mvOsPrintf("Board: twsi exp out val succeded\n")); - - /* Change twsi exp to output */ - twsiSlave.offset = 7; - muxVal = 0xfe; - if(mvBoardIdGet() == RD_88F6281A_ID) - muxVal = 0xf3; - - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - muxVal = (twsiVal & muxVal); - - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &muxVal, 1) ) - { - mvOsPrintf("Board: twsi exp change to out fail\n"); - return; - } - DB(mvOsPrintf("Board: twsi exp change to out succeded\n")); - /* reset the line to 0 */ - twsiSlave.offset = 3; - muxVal = 0; - muxValMask = 1; - - if(mvBoardIdGet() == RD_88F6281A_ID) { - muxVal = 0x0; - muxValMask = 0xf3; - } - - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - muxVal = (twsiVal & muxValMask) | muxVal; - - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &muxVal, 1) ) - { - mvOsPrintf("Board: twsi exp out val fail\n"); - return; - } - DB(mvOsPrintf("Board: twsi exp out val succeded\n")); - - mvOsDelay(20); - - /* set the line to 1 */ - twsiSlave.offset = 3; - muxVal = 1; - muxValMask = 1; - - if(mvBoardIdGet() == RD_88F6281A_ID) - { - muxVal = 0xc; - muxValMask = 0xf3; - if(chType) /* FXS - issue reset properly */ - { - MV_REG_BIT_SET(GPP_DATA_OUT_REG(1), MV_GPP12); - mvOsDelay(50); - MV_REG_BIT_RESET(GPP_DATA_OUT_REG(1), MV_GPP12); - } - else /* FXO - issue reset via TDM_CODEC_RST*/ - { - /* change MPP44 type to TDM_CODEC_RST(0x2) */ - MV_REG_WRITE(MPP_CONTROL_REG5, ((MV_REG_READ(MPP_CONTROL_REG5) & 0xFFF0FFFF) | BIT17)); - } - } - - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - muxVal = (twsiVal & muxValMask) | muxVal; - - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &muxVal, 1) ) - { - mvOsPrintf("Board: twsi exp out val fail\n"); - return; - } - - /* TBD - 5 channels */ -#if defined(MV_TDM_5CHANNELS) - /* change MPP38 type to GPIO(0x0) & polarity for TDM_STROBE */ - MV_REG_WRITE(MPP_CONTROL_REG4, (MV_REG_READ(MPP_CONTROL_REG4) & 0xF0FFFFFF)); - mvGppPolaritySet(1, MV_GPP6, 0); - - twsiSlave.offset = 6; - twsiSlave.slaveAddr.address = mvBoardTwsiExpAddrGet(2); - - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - muxVal = (twsiVal & ~BIT2); - - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &muxVal, 1) ) - { - mvOsPrintf("Board: twsi exp change to out fail\n"); - return; - } - - - twsiSlave.offset = 2; - - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - muxVal = (twsiVal & ~BIT2); - - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &muxVal, 1) ) - { - mvOsPrintf("Board: twsi exp change to out fail\n"); - return; - } -#endif - DB(mvOsPrintf("Board: twsi exp out val succeded\n")); - - -} -/******************************************************************************* -* mvBoardVoiceConnModeGet - return SLIC/DAA connection & interrupt modes -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -*******************************************************************************/ - -MV_VOID mvBoardVoiceConnModeGet(MV_32* connMode, MV_32* irqMode) -{ - switch(mvBoardIdGet()) - { - case RD_88F6281A_ID: - *connMode = DAISY_CHAIN_MODE; - *irqMode = INTERRUPT_TO_TDM; - break; - case DB_88F6281A_BP_ID: - *connMode = DUAL_CHIP_SELECT_MODE; - *irqMode = INTERRUPT_TO_TDM; - break; - case RD_88F6192A_ID: - *connMode = DUAL_CHIP_SELECT_MODE; - *irqMode = INTERRUPT_TO_TDM; - break; - case DB_88F6192A_BP_ID: - *connMode = DUAL_CHIP_SELECT_MODE; - *irqMode = INTERRUPT_TO_TDM; - break; - default: - *connMode = *irqMode = -1; - mvOsPrintf("mvBoardVoiceAssembleModeGet: TDM not supported(boardId=0x%x)\n",mvBoardIdGet()); - } - return; - -} - -/******************************************************************************* -* mvBoardMppModuleTypePrint - print module detect -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -*******************************************************************************/ -MV_VOID mvBoardMppModuleTypePrint(MV_VOID) -{ - - MV_BOARD_MPP_GROUP_CLASS devClass; - MV_BOARD_MPP_TYPE_CLASS mppGroupType; - MV_U32 devId; - MV_U32 maxMppGrp = 1; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - maxMppGrp = MV_6281_MPP_MAX_MODULE; - break; - case MV_6192_DEV_ID: - maxMppGrp = MV_6192_MPP_MAX_MODULE; - break; - case MV_6190_DEV_ID: - maxMppGrp = MV_6190_MPP_MAX_MODULE; - break; - case MV_6180_DEV_ID: - maxMppGrp = MV_6180_MPP_MAX_MODULE; - break; - } - - for (devClass = 0; devClass < maxMppGrp; devClass++) - { - mppGroupType = mvBoardMppGroupTypeGet(devClass); - - switch(mppGroupType) - { - case MV_BOARD_TDM: - if(devId != MV_6190_DEV_ID) - mvOsPrintf("Module %d is TDM\n", devClass); - break; - case MV_BOARD_AUDIO: - if(devId != MV_6190_DEV_ID) - mvOsPrintf("Module %d is AUDIO\n", devClass); - break; - case MV_BOARD_RGMII: - if(devId != MV_6190_DEV_ID) - mvOsPrintf("Module %d is RGMII\n", devClass); - break; - case MV_BOARD_GMII: - if(devId != MV_6190_DEV_ID) - mvOsPrintf("Module %d is GMII\n", devClass); - break; - case MV_BOARD_TS: - if(devId != MV_6190_DEV_ID) - mvOsPrintf("Module %d is TS\n", devClass); - break; - default: - break; - } - } -} - -/* Board devices API managments */ - -/******************************************************************************* -* mvBoardGetDeviceNumber - Get number of device of some type on the board -* -* DESCRIPTION: -* -* INPUT: -* devType - The device type ( Flash,RTC , etc .. ) -* -* OUTPUT: -* None. -* -* RETURN: -* If the device is found on the board the then the functions returns the -* number of those devices else the function returns 0 -* -* -*******************************************************************************/ -MV_32 mvBoardGetDevicesNumber(MV_BOARD_DEV_CLASS devClass) -{ - MV_U32 foundIndex=0,devNum; - MV_U32 boardId= mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("mvBoardGetDeviceNumber:Board unknown.\n"); - return 0xFFFFFFFF; - - } - - for (devNum = START_DEV_CS; devNum < BOARD_INFO(boardId)->numBoardDeviceIf; devNum++) - { - if (BOARD_INFO(boardId)->pDevCsInfo[devNum].devClass == devClass) - { - foundIndex++; - } - } - - return foundIndex; - -} - -/******************************************************************************* -* mvBoardGetDeviceBaseAddr - Get base address of a device existing on the board -* -* DESCRIPTION: -* -* INPUT: -* devIndex - The device sequential number on the board -* devType - The device type ( Flash,RTC , etc .. ) -* -* OUTPUT: -* None. -* -* RETURN: -* If the device is found on the board the then the functions returns the -* Base address else the function returns 0xffffffff -* -* -*******************************************************************************/ -MV_32 mvBoardGetDeviceBaseAddr(MV_32 devNum, MV_BOARD_DEV_CLASS devClass) -{ - MV_DEV_CS_INFO* devEntry; - devEntry = boardGetDevEntry(devNum,devClass); - if (devEntry != NULL) - { - return mvCpuIfTargetWinBaseLowGet(DEV_TO_TARGET(devEntry->deviceCS)); - - } - - return 0xFFFFFFFF; -} - -/******************************************************************************* -* mvBoardGetDeviceBusWidth - Get Bus width of a device existing on the board -* -* DESCRIPTION: -* -* INPUT: -* devIndex - The device sequential number on the board -* devType - The device type ( Flash,RTC , etc .. ) -* -* OUTPUT: -* None. -* -* RETURN: -* If the device is found on the board the then the functions returns the -* Bus width else the function returns 0xffffffff -* -* -*******************************************************************************/ -MV_32 mvBoardGetDeviceBusWidth(MV_32 devNum, MV_BOARD_DEV_CLASS devClass) -{ - MV_DEV_CS_INFO* devEntry; - - devEntry = boardGetDevEntry(devNum,devClass); - if (devEntry != NULL) - { - return 8; - } - - return 0xFFFFFFFF; - -} - -/******************************************************************************* -* mvBoardGetDeviceWidth - Get dev width of a device existing on the board -* -* DESCRIPTION: -* -* INPUT: -* devIndex - The device sequential number on the board -* devType - The device type ( Flash,RTC , etc .. ) -* -* OUTPUT: -* None. -* -* RETURN: -* If the device is found on the board the then the functions returns the -* dev width else the function returns 0xffffffff -* -* -*******************************************************************************/ -MV_32 mvBoardGetDeviceWidth(MV_32 devNum, MV_BOARD_DEV_CLASS devClass) -{ - MV_DEV_CS_INFO* devEntry; - MV_U32 boardId= mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("Board unknown.\n"); - return 0xFFFFFFFF; - } - - devEntry = boardGetDevEntry(devNum,devClass); - if (devEntry != NULL) - return devEntry->devWidth; - - return MV_ERROR; - -} - -/******************************************************************************* -* mvBoardGetDeviceWinSize - Get the window size of a device existing on the board -* -* DESCRIPTION: -* -* INPUT: -* devIndex - The device sequential number on the board -* devType - The device type ( Flash,RTC , etc .. ) -* -* OUTPUT: -* None. -* -* RETURN: -* If the device is found on the board the then the functions returns the -* window size else the function returns 0xffffffff -* -* -*******************************************************************************/ -MV_32 mvBoardGetDeviceWinSize(MV_32 devNum, MV_BOARD_DEV_CLASS devClass) -{ - MV_DEV_CS_INFO* devEntry; - MV_U32 boardId = mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("Board unknown.\n"); - return 0xFFFFFFFF; - } - - devEntry = boardGetDevEntry(devNum,devClass); - if (devEntry != NULL) - { - return mvCpuIfTargetWinSizeGet(DEV_TO_TARGET(devEntry->deviceCS)); - } - - return 0xFFFFFFFF; -} - - -/******************************************************************************* -* boardGetDevEntry - returns the entry pointer of a device on the board -* -* DESCRIPTION: -* -* INPUT: -* devIndex - The device sequential number on the board -* devType - The device type ( Flash,RTC , etc .. ) -* -* OUTPUT: -* None. -* -* RETURN: -* If the device is found on the board the then the functions returns the -* dev number else the function returns 0x0 -* -* -*******************************************************************************/ -static MV_DEV_CS_INFO* boardGetDevEntry(MV_32 devNum, MV_BOARD_DEV_CLASS devClass) -{ - MV_U32 foundIndex=0,devIndex; - MV_U32 boardId= mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("boardGetDevEntry: Board unknown.\n"); - return NULL; - - } - - for (devIndex = START_DEV_CS; devIndex < BOARD_INFO(boardId)->numBoardDeviceIf; devIndex++) - { - /* TBR */ - /*if (BOARD_INFO(boardId)->pDevCsInfo[devIndex].deviceCS == MV_BOOTDEVICE_INDEX) - continue;*/ - - if (BOARD_INFO(boardId)->pDevCsInfo[devIndex].devClass == devClass) - { - if (foundIndex == devNum) - { - return &(BOARD_INFO(boardId)->pDevCsInfo[devIndex]); - } - foundIndex++; - } - } - - /* device not found */ - return NULL; -} - -/* Get device CS number */ - -MV_U32 boardGetDevCSNum(MV_32 devNum, MV_BOARD_DEV_CLASS devClass) -{ - MV_DEV_CS_INFO* devEntry; - MV_U32 boardId= mvBoardIdGet(); - - if (!((boardId >= BOARD_ID_BASE)&&(boardId < MV_MAX_BOARD_ID))) - { - mvOsPrintf("Board unknown.\n"); - return 0xFFFFFFFF; - - } - - - devEntry = boardGetDevEntry(devNum,devClass); - if (devEntry != NULL) - return devEntry->deviceCS; - - return 0xFFFFFFFF; - -} - -/******************************************************************************* -* mvBoardRtcTwsiAddrTypeGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -* -*******************************************************************************/ -MV_U8 mvBoardRtcTwsiAddrTypeGet() -{ - int i; - MV_U32 boardId= mvBoardIdGet(); - - for (i = 0; i < BOARD_INFO(boardId)->numBoardTwsiDev; i++) - if (BOARD_INFO(boardId)->pBoardTwsiDev[i].devClass == BOARD_TWSI_RTC) - return BOARD_INFO(boardId)->pBoardTwsiDev[i].twsiDevAddrType; - return (MV_ERROR); -} - -/******************************************************************************* -* mvBoardRtcTwsiAddrGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -* -*******************************************************************************/ -MV_U8 mvBoardRtcTwsiAddrGet() -{ - int i; - MV_U32 boardId= mvBoardIdGet(); - - for (i = 0; i < BOARD_INFO(boardId)->numBoardTwsiDev; i++) - if (BOARD_INFO(boardId)->pBoardTwsiDev[i].devClass == BOARD_TWSI_RTC) - return BOARD_INFO(boardId)->pBoardTwsiDev[i].twsiDevAddr; - return (0xFF); -} - -/******************************************************************************* -* mvBoardA2DTwsiAddrTypeGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -* -*******************************************************************************/ -MV_U8 mvBoardA2DTwsiAddrTypeGet() -{ - int i; - MV_U32 boardId= mvBoardIdGet(); - - for (i = 0; i < BOARD_INFO(boardId)->numBoardTwsiDev; i++) - if (BOARD_INFO(boardId)->pBoardTwsiDev[i].devClass == BOARD_TWSI_AUDIO_DEC) - return BOARD_INFO(boardId)->pBoardTwsiDev[i].twsiDevAddrType; - return (MV_ERROR); -} - -/******************************************************************************* -* mvBoardA2DTwsiAddrGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -* -*******************************************************************************/ -MV_U8 mvBoardA2DTwsiAddrGet() -{ - int i; - MV_U32 boardId= mvBoardIdGet(); - - for (i = 0; i < BOARD_INFO(boardId)->numBoardTwsiDev; i++) - if (BOARD_INFO(boardId)->pBoardTwsiDev[i].devClass == BOARD_TWSI_AUDIO_DEC) - return BOARD_INFO(boardId)->pBoardTwsiDev[i].twsiDevAddr; - return (0xFF); -} - -/******************************************************************************* -* mvBoardTwsiExpAddrTypeGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -* -*******************************************************************************/ -MV_U8 mvBoardTwsiExpAddrTypeGet(MV_U32 index) -{ - int i; - MV_U32 indexFound = 0; - MV_U32 boardId= mvBoardIdGet(); - - for (i = 0; i < BOARD_INFO(boardId)->numBoardTwsiDev; i++) - if (BOARD_INFO(boardId)->pBoardTwsiDev[i].devClass == BOARD_DEV_TWSI_EXP) - { - if (indexFound == index) - return BOARD_INFO(boardId)->pBoardTwsiDev[i].twsiDevAddrType; - else - indexFound++; - } - - return (MV_ERROR); -} - -/******************************************************************************* -* mvBoardTwsiExpAddrGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -* -*******************************************************************************/ -MV_U8 mvBoardTwsiExpAddrGet(MV_U32 index) -{ - int i; - MV_U32 indexFound = 0; - MV_U32 boardId= mvBoardIdGet(); - - for (i = 0; i < BOARD_INFO(boardId)->numBoardTwsiDev; i++) - if (BOARD_INFO(boardId)->pBoardTwsiDev[i].devClass == BOARD_DEV_TWSI_EXP) - { - if (indexFound == index) - return BOARD_INFO(boardId)->pBoardTwsiDev[i].twsiDevAddr; - else - indexFound++; - } - - return (0xFF); -} - - -/******************************************************************************* -* mvBoardTwsiSatRAddrTypeGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -* -*******************************************************************************/ -MV_U8 mvBoardTwsiSatRAddrTypeGet(MV_U32 index) -{ - int i; - MV_U32 indexFound = 0; - MV_U32 boardId= mvBoardIdGet(); - - for (i = 0; i < BOARD_INFO(boardId)->numBoardTwsiDev; i++) - if (BOARD_INFO(boardId)->pBoardTwsiDev[i].devClass == BOARD_DEV_TWSI_SATR) - { - if (indexFound == index) - return BOARD_INFO(boardId)->pBoardTwsiDev[i].twsiDevAddrType; - else - indexFound++; - } - - return (MV_ERROR); -} - -/******************************************************************************* -* mvBoardTwsiSatRAddrGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -* -*******************************************************************************/ -MV_U8 mvBoardTwsiSatRAddrGet(MV_U32 index) -{ - int i; - MV_U32 indexFound = 0; - MV_U32 boardId= mvBoardIdGet(); - - for (i = 0; i < BOARD_INFO(boardId)->numBoardTwsiDev; i++) - if (BOARD_INFO(boardId)->pBoardTwsiDev[i].devClass == BOARD_DEV_TWSI_SATR) - { - if (indexFound == index) - return BOARD_INFO(boardId)->pBoardTwsiDev[i].twsiDevAddr; - else - indexFound++; - } - - return (0xFF); -} - -/******************************************************************************* -* mvBoardNandWidthGet - -* -* DESCRIPTION: Get the width of the first NAND device in byte. -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: 1, 2, 4 or MV_ERROR -* -* -*******************************************************************************/ -/* */ -MV_32 mvBoardNandWidthGet(void) -{ - MV_U32 devNum; - MV_U32 devWidth; - MV_U32 boardId= mvBoardIdGet(); - - for (devNum = START_DEV_CS; devNum < BOARD_INFO(boardId)->numBoardDeviceIf; devNum++) - { - devWidth = mvBoardGetDeviceWidth(devNum, BOARD_DEV_NAND_FLASH); - if (devWidth != MV_ERROR) - return (devWidth / 8); - } - - /* NAND wasn't found */ - return MV_ERROR; -} - -MV_U32 gBoardId = -1; - -/******************************************************************************* -* mvBoardIdGet - Get Board model -* -* DESCRIPTION: -* This function returns board ID. -* Board ID is 32bit word constructed of board model (16bit) and -* board revision (16bit) in the following way: 0xMMMMRRRR. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit board ID number, '-1' if board is undefined. -* -*******************************************************************************/ -MV_U32 mvBoardIdGet(MV_VOID) -{ - MV_U32 tmpBoardId = -1; - - if(gBoardId == -1) - { - #if defined(DB_88F6281A) - tmpBoardId = DB_88F6281A_BP_ID; - #elif defined(RD_88F6281A) - tmpBoardId = RD_88F6281A_ID; - #elif defined(DB_88F6192A) - tmpBoardId = DB_88F6192A_BP_ID; - #elif defined(DB_88F6190A) - tmpBoardId = DB_88F6190A_BP_ID; - #elif defined(RD_88F6192A) - tmpBoardId = RD_88F6192A_ID; - #elif defined(RD_88F6190A) - tmpBoardId = RD_88F6190A_ID; - #elif defined(DB_88F6180A) - tmpBoardId = DB_88F6180A_BP_ID; - #elif defined(RD_88F6281A_PCAC) - tmpBoardId = RD_88F6281A_PCAC_ID; - #elif defined(RD_88F6281A_SHEEVA_PLUG) - tmpBoardId = SHEEVA_PLUG_ID; - #elif defined(DB_CUSTOMER) - tmpBoardId = DB_CUSTOMER_ID; - #endif - gBoardId = tmpBoardId; - } - - return gBoardId; -} - - -/******************************************************************************* -* mvBoarModuleTypeGet - mvBoarModuleTypeGet -* -* DESCRIPTION: -* -* INPUT: -* group num - MV_BOARD_MPP_GROUP_CLASS enum -* -* OUTPUT: -* None. -* -* RETURN: -* module num - MV_BOARD_MODULE_CLASS enum -* -*******************************************************************************/ -MV_BOARD_MODULE_ID_CLASS mvBoarModuleTypeGet(MV_BOARD_MPP_GROUP_CLASS devClass) -{ - MV_TWSI_SLAVE twsiSlave; - MV_TWSI_ADDR slave; - MV_U8 data; - - /* TWSI init */ - slave.type = ADDR7_BIT; - slave.address = 0; - mvTwsiInit(0, TWSI_SPEED, mvBoardTclkGet(), &slave, 0); - - /* Read MPP module ID */ - DB(mvOsPrintf("Board: Read MPP module ID\n")); - twsiSlave.slaveAddr.address = mvBoardTwsiExpAddrGet(devClass); - twsiSlave.slaveAddr.type = mvBoardTwsiExpAddrTypeGet(devClass); - twsiSlave.validOffset = MV_TRUE; - /* Offset is the first command after the address which indicate the register number to be read - in next operation */ - twsiSlave.offset = 0; - twsiSlave.moreThen256 = MV_FALSE; - - - - if( MV_OK != mvTwsiRead (0, &twsiSlave, &data, 1) ) - { - DB(mvOsPrintf("Board: Read MPP module ID fail\n")); - return MV_ERROR; - } - DB(mvOsPrintf("Board: Read MPP module ID succeded\n")); - - return data; -} - -/******************************************************************************* -* mvBoarTwsiSatRGet - -* -* DESCRIPTION: -* -* INPUT: -* device num - one of three devices -* reg num - 0 or 1 -* -* OUTPUT: -* None. -* -* RETURN: -* reg value -* -*******************************************************************************/ -MV_U8 mvBoarTwsiSatRGet(MV_U8 devNum, MV_U8 regNum) -{ - MV_TWSI_SLAVE twsiSlave; - MV_TWSI_ADDR slave; - MV_U8 data; - - /* TWSI init */ - slave.type = ADDR7_BIT; - slave.address = 0; - mvTwsiInit(0, TWSI_SPEED, mvBoardTclkGet(), &slave, 0); - - /* Read MPP module ID */ - DB(mvOsPrintf("Board: Read S@R device read\n")); - twsiSlave.slaveAddr.address = mvBoardTwsiSatRAddrGet(devNum); - twsiSlave.slaveAddr.type = mvBoardTwsiSatRAddrTypeGet(devNum); - twsiSlave.validOffset = MV_TRUE; - /* Use offset as command */ - twsiSlave.offset = regNum; - twsiSlave.moreThen256 = MV_FALSE; - - if( MV_OK != mvTwsiRead (0, &twsiSlave, &data, 1) ) - { - DB(mvOsPrintf("Board: Read S@R fail\n")); - return MV_ERROR; - } - DB(mvOsPrintf("Board: Read S@R succeded\n")); - - return data; -} - -/******************************************************************************* -* mvBoarTwsiSatRSet - -* -* DESCRIPTION: -* -* INPUT: -* devNum - one of three devices -* regNum - 0 or 1 -* regVal - value -* -* -* OUTPUT: -* None. -* -* RETURN: -* reg value -* -*******************************************************************************/ -MV_STATUS mvBoarTwsiSatRSet(MV_U8 devNum, MV_U8 regNum, MV_U8 regVal) -{ - MV_TWSI_SLAVE twsiSlave; - MV_TWSI_ADDR slave; - - /* TWSI init */ - slave.type = ADDR7_BIT; - slave.address = 0; - mvTwsiInit(0, TWSI_SPEED, mvBoardTclkGet(), &slave, 0); - - /* Read MPP module ID */ - twsiSlave.slaveAddr.address = mvBoardTwsiSatRAddrGet(devNum); - twsiSlave.slaveAddr.type = mvBoardTwsiSatRAddrTypeGet(devNum); - twsiSlave.validOffset = MV_TRUE; - DB(mvOsPrintf("Board: Write S@R device addr %x, type %x, data %x\n", twsiSlave.slaveAddr.address,\ - twsiSlave.slaveAddr.type, regVal)); - /* Use offset as command */ - twsiSlave.offset = regNum; - twsiSlave.moreThen256 = MV_FALSE; - if( MV_OK != mvTwsiWrite (0, &twsiSlave, ®Val, 1) ) - { - DB(mvOsPrintf("Board: Write S@R fail\n")); - return MV_ERROR; - } - DB(mvOsPrintf("Board: Write S@R succeded\n")); - - return MV_OK; -} - -/******************************************************************************* -* mvBoardSlicGpioPinGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* -* -*******************************************************************************/ -MV_32 mvBoardSlicGpioPinGet(MV_U32 slicNum) -{ - MV_U32 boardId; - boardId = mvBoardIdGet(); - - switch (boardId) - { - case DB_88F6281A_BP_ID: - case RD_88F6281A_ID: - default: - return MV_ERROR; - break; - - } -} - -/******************************************************************************* -* mvBoardFanPowerControl - Turn on/off the fan power control on the RD-6281A -* -* DESCRIPTION: -* -* INPUT: -* mode - MV_TRUE = on ; MV_FALSE = off -* -* OUTPUT: -* MV_STATUS - MV_OK , MV_ERROR. -* -* RETURN: -* -*******************************************************************************/ -MV_STATUS mvBoardFanPowerControl(MV_BOOL mode) -{ - - MV_U8 val = 1, twsiVal; - MV_TWSI_SLAVE twsiSlave; - MV_TWSI_ADDR slave; - - if(mvBoardIdGet() != RD_88F6281A_ID) - return MV_ERROR; - - /* TWSI init */ - slave.type = ADDR7_BIT; - slave.address = 0; - mvTwsiInit(0, TWSI_SPEED, mvBoardTclkGet(), &slave, 0); - - /* Read MPP module ID */ - DB(mvOsPrintf("Board: twsi exp set\n")); - twsiSlave.slaveAddr.address = mvBoardTwsiExpAddrGet(1); - twsiSlave.slaveAddr.type = ADDR7_BIT; - twsiSlave.validOffset = MV_TRUE; - /* Offset is the first command after the address which indicate the register number to be read - in next operation */ - twsiSlave.offset = 3; - twsiSlave.moreThen256 = MV_FALSE; - if(mode == MV_TRUE) - val = 0x1; - else - val = 0; - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - val = (twsiVal & 0xfe) | val; - - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &val, 1) ) - { - DB(mvOsPrintf("Board: twsi exp out val fail\n")); - return MV_ERROR; - } - DB(mvOsPrintf("Board: twsi exp out val succeded\n")); - - /* Change twsi exp to output */ - twsiSlave.offset = 7; - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - val = (twsiVal & 0xfe); - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &val, 1) ) - { - DB(mvOsPrintf("Board: twsi exp change to out fail\n")); - return MV_ERROR; - } - DB(mvOsPrintf("Board: twsi exp change to out succeded\n")); - return MV_OK; -} - -/******************************************************************************* -* mvBoardHDDPowerControl - Turn on/off the HDD power control on the RD-6281A -* -* DESCRIPTION: -* -* INPUT: -* mode - MV_TRUE = on ; MV_FALSE = off -* -* OUTPUT: -* MV_STATUS - MV_OK , MV_ERROR. -* -* RETURN: -* -*******************************************************************************/ -MV_STATUS mvBoardHDDPowerControl(MV_BOOL mode) -{ - - MV_U8 val = 1, twsiVal; - MV_TWSI_SLAVE twsiSlave; - MV_TWSI_ADDR slave; - - if(mvBoardIdGet() != RD_88F6281A_ID) - return MV_ERROR; - - /* TWSI init */ - slave.type = ADDR7_BIT; - slave.address = 0; - mvTwsiInit(0, TWSI_SPEED, mvBoardTclkGet(), &slave, 0); - - /* Read MPP module ID */ - DB(mvOsPrintf("Board: twsi exp set\n")); - twsiSlave.slaveAddr.address = mvBoardTwsiExpAddrGet(1); - twsiSlave.slaveAddr.type = ADDR7_BIT; - twsiSlave.validOffset = MV_TRUE; - /* Offset is the first command after the address which indicate the register number to be read - in next operation */ - twsiSlave.offset = 3; - twsiSlave.moreThen256 = MV_FALSE; - if(mode == MV_TRUE) - val = 0x2; - else - val = 0; - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - val = (twsiVal & 0xfd) | val; - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &val, 1) ) - { - DB(mvOsPrintf("Board: twsi exp out val fail\n")); - return MV_ERROR; - } - DB(mvOsPrintf("Board: twsi exp out val succeded\n")); - - /* Change twsi exp to output */ - twsiSlave.offset = 7; - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - val = (twsiVal & 0xfd); - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &val, 1) ) - { - DB(mvOsPrintf("Board: twsi exp change to out fail\n")); - return MV_ERROR; - } - DB(mvOsPrintf("Board: twsi exp change to out succeded\n")); - return MV_OK; -} - -/******************************************************************************* -* mvBoardSDioWPControl - Turn on/off the SDIO WP on the RD-6281A -* -* DESCRIPTION: -* -* INPUT: -* mode - MV_TRUE = on ; MV_FALSE = off -* -* OUTPUT: -* MV_STATUS - MV_OK , MV_ERROR. -* -* RETURN: -* -*******************************************************************************/ -MV_STATUS mvBoardSDioWPControl(MV_BOOL mode) -{ - - MV_U8 val = 1, twsiVal; - MV_TWSI_SLAVE twsiSlave; - MV_TWSI_ADDR slave; - - if(mvBoardIdGet() != RD_88F6281A_ID) - return MV_ERROR; - - /* TWSI init */ - slave.type = ADDR7_BIT; - slave.address = 0; - mvTwsiInit(0, TWSI_SPEED, mvBoardTclkGet(), &slave, 0); - - /* Read MPP module ID */ - DB(mvOsPrintf("Board: twsi exp set\n")); - twsiSlave.slaveAddr.address = mvBoardTwsiExpAddrGet(0); - twsiSlave.slaveAddr.type = ADDR7_BIT; - twsiSlave.validOffset = MV_TRUE; - /* Offset is the first command after the address which indicate the register number to be read - in next operation */ - twsiSlave.offset = 3; - twsiSlave.moreThen256 = MV_FALSE; - if(mode == MV_TRUE) - val = 0x10; - else - val = 0; - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - val = (twsiVal & 0xef) | val; - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &val, 1) ) - { - DB(mvOsPrintf("Board: twsi exp out val fail\n")); - return MV_ERROR; - } - DB(mvOsPrintf("Board: twsi exp out val succeded\n")); - - /* Change twsi exp to output */ - twsiSlave.offset = 7; - mvTwsiRead(0, &twsiSlave, &twsiVal, 1); - val = (twsiVal & 0xef); - if( MV_OK != mvTwsiWrite (0, &twsiSlave, &val, 1) ) - { - DB(mvOsPrintf("Board: twsi exp change to out fail\n")); - return MV_ERROR; - } - DB(mvOsPrintf("Board: twsi exp change to out succeded\n")); - return MV_OK; -} - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvLib.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvLib.h deleted file mode 100644 index dead633695..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvLib.h +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ -#ifndef __INCmvBoardEnvLibh -#define __INCmvBoardEnvLibh - -/* defines */ -/* The below constant macros defines the board I2C EEPROM data offsets */ - - - -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "mvSysHwConfig.h" -#include "boardEnv/mvBoardEnvSpec.h" - - -/* DUART stuff for Tclk detection only */ -#define DUART_BAUD_RATE 115200 -#define MAX_CLOCK_MARGINE 5000000 /* Maximum detected clock margine */ - -/* Voice devices assembly modes */ -#define DAISY_CHAIN_MODE 1 -#define DUAL_CHIP_SELECT_MODE 0 -#define INTERRUPT_TO_MPP 1 -#define INTERRUPT_TO_TDM 0 - - -#define BOARD_ETH_PORT_NUM MV_ETH_MAX_PORTS -#define BOARD_ETH_SWITCH_PORT_NUM 5 - -#define MV_BOARD_MAX_USB_IF 1 -#define MV_BOARD_MAX_MPP 7 -#define MV_BOARD_NAME_LEN 0x20 - -typedef struct _boardData -{ - MV_U32 magic; - MV_U16 boardId; - MV_U8 boardVer; - MV_U8 boardRev; - MV_U32 reserved1; - MV_U32 reserved2; - -}BOARD_DATA; - -typedef enum _devBoardMppGroupClass -{ - MV_BOARD_MPP_GROUP_1, - MV_BOARD_MPP_GROUP_2, - MV_BOARD_MAX_MPP_GROUP -}MV_BOARD_MPP_GROUP_CLASS; - -typedef enum _devBoardMppTypeClass -{ - MV_BOARD_AUTO, - MV_BOARD_TDM, - MV_BOARD_AUDIO, - MV_BOARD_RGMII, - MV_BOARD_GMII, - MV_BOARD_TS, - MV_BOARD_MII, - MV_BOARD_OTHER -}MV_BOARD_MPP_TYPE_CLASS; - -typedef enum _devBoardModuleIdClass -{ - MV_BOARD_MODULE_TDM_ID = 1, - MV_BOARD_MODULE_AUDIO_ID, - MV_BOARD_MODULE_RGMII_ID, - MV_BOARD_MODULE_GMII_ID, - MV_BOARD_MODULE_TS_ID, - MV_BOARD_MODULE_MII_ID, - MV_BOARD_MODULE_TDM_5CHAN_ID, - MV_BOARD_MODULE_OTHER_ID -}MV_BOARD_MODULE_ID_CLASS; - -typedef struct _boardMppTypeInfo -{ - MV_BOARD_MPP_TYPE_CLASS boardMppGroup1; - MV_BOARD_MPP_TYPE_CLASS boardMppGroup2; - -}MV_BOARD_MPP_TYPE_INFO; - - -typedef enum _devBoardClass -{ - BOARD_DEV_NOR_FLASH, - BOARD_DEV_NAND_FLASH, - BOARD_DEV_SEVEN_SEG, - BOARD_DEV_FPGA, - BOARD_DEV_SRAM, - BOARD_DEV_SPI_FLASH, - BOARD_DEV_OTHER, -}MV_BOARD_DEV_CLASS; - -typedef enum _devTwsiBoardClass -{ - BOARD_TWSI_RTC, - BOARD_DEV_TWSI_EXP, - BOARD_DEV_TWSI_SATR, - BOARD_TWSI_AUDIO_DEC, - BOARD_TWSI_OTHER -}MV_BOARD_TWSI_CLASS; - -typedef enum _devGppBoardClass -{ - BOARD_GPP_RTC, - BOARD_GPP_MV_SWITCH, - BOARD_GPP_USB_VBUS, - BOARD_GPP_USB_VBUS_EN, - BOARD_GPP_USB_OC, - BOARD_GPP_USB_HOST_DEVICE, - BOARD_GPP_REF_CLCK, - BOARD_GPP_VOIP_SLIC, - BOARD_GPP_LIFELINE, - BOARD_GPP_BUTTON, - BOARD_GPP_TS_BUTTON_C, - BOARD_GPP_TS_BUTTON_U, - BOARD_GPP_TS_BUTTON_D, - BOARD_GPP_TS_BUTTON_L, - BOARD_GPP_TS_BUTTON_R, - BOARD_GPP_POWER_BUTTON, - BOARD_GPP_RESTOR_BUTTON, - BOARD_GPP_WPS_BUTTON, - BOARD_GPP_HDD0_POWER, - BOARD_GPP_HDD1_POWER, - BOARD_GPP_FAN_POWER, - BOARD_GPP_RESET, - BOARD_GPP_POWER_ON_LED, - BOARD_GPP_HDD_POWER, - BOARD_GPP_SDIO_POWER, - BOARD_GPP_SDIO_DETECT, - BOARD_GPP_SDIO_WP, - BOARD_GPP_SWITCH_PHY_INT, - BOARD_GPP_TSU_DIRCTION, - BOARD_GPP_OTHER -}MV_BOARD_GPP_CLASS; - - -typedef struct _devCsInfo -{ - MV_U8 deviceCS; - MV_U32 params; - MV_U32 devClass; /* MV_BOARD_DEV_CLASS */ - MV_U8 devWidth; - -}MV_DEV_CS_INFO; - - -#define MV_BOARD_PHY_FORCE_10MB 0x0 -#define MV_BOARD_PHY_FORCE_100MB 0x1 -#define MV_BOARD_PHY_FORCE_1000MB 0x2 -#define MV_BOARD_PHY_SPEED_AUTO 0x3 - -typedef struct _boardSwitchInfo -{ - MV_32 linkStatusIrq; - MV_32 qdPort[BOARD_ETH_SWITCH_PORT_NUM]; - MV_32 qdCpuPort; - MV_32 smiScanMode; /* 1 for SMI_MANUAL_MODE, 0 otherwise */ - MV_32 switchOnPort; - -}MV_BOARD_SWITCH_INFO; - -typedef struct _boardLedInfo -{ - MV_U8 activeLedsNumber; - MV_U8 ledsPolarity; /* '0' or '1' to turn on led */ - MV_U8* gppPinNum; /* Pointer to GPP values */ - -}MV_BOARD_LED_INFO; - -typedef struct _boardGppInfo -{ - MV_BOARD_GPP_CLASS devClass; - MV_U8 gppPinNum; - -}MV_BOARD_GPP_INFO; - - -typedef struct _boardTwsiInfo -{ - MV_BOARD_TWSI_CLASS devClass; - MV_U8 twsiDevAddr; - MV_U8 twsiDevAddrType; - -}MV_BOARD_TWSI_INFO; - - -typedef enum _boardMacSpeed -{ - BOARD_MAC_SPEED_10M, - BOARD_MAC_SPEED_100M, - BOARD_MAC_SPEED_1000M, - BOARD_MAC_SPEED_AUTO, - -}MV_BOARD_MAC_SPEED; - -typedef struct _boardMacInfo -{ - MV_BOARD_MAC_SPEED boardMacSpeed; - MV_U8 boardEthSmiAddr; - -}MV_BOARD_MAC_INFO; - -typedef struct _boardMppInfo -{ - MV_U32 mppGroup[MV_BOARD_MAX_MPP]; - -}MV_BOARD_MPP_INFO; - -typedef struct _boardInfo -{ - char boardName[MV_BOARD_NAME_LEN]; - MV_U8 numBoardMppTypeValue; - MV_BOARD_MPP_TYPE_INFO* pBoardMppTypeValue; - MV_U8 numBoardMppConfigValue; - MV_BOARD_MPP_INFO* pBoardMppConfigValue; - MV_U32 intsGppMaskLow; - MV_U32 intsGppMaskHigh; - MV_U8 numBoardDeviceIf; - MV_DEV_CS_INFO* pDevCsInfo; - MV_U8 numBoardTwsiDev; - MV_BOARD_TWSI_INFO* pBoardTwsiDev; - MV_U8 numBoardMacInfo; - MV_BOARD_MAC_INFO* pBoardMacInfo; - MV_U8 numBoardGppInfo; - MV_BOARD_GPP_INFO* pBoardGppInfo; - MV_U8 activeLedsNumber; - MV_U8* pLedGppPin; - MV_U8 ledsPolarity; /* '0' or '1' to turn on led */ - /* GPP values */ - MV_U32 gppOutEnValLow; - MV_U32 gppOutEnValHigh; - MV_U32 gppOutValLow; - MV_U32 gppOutValHigh; - MV_U32 gppPolarityValLow; - MV_U32 gppPolarityValHigh; - - /* Switch Configuration */ - MV_BOARD_SWITCH_INFO* pSwitchInfo; -}MV_BOARD_INFO; - - - -MV_VOID mvBoardEnvInit(MV_VOID); -MV_U32 mvBoardIdGet(MV_VOID); -MV_U16 mvBoardModelGet(MV_VOID); -MV_U16 mvBoardRevGet(MV_VOID); -MV_STATUS mvBoardNameGet(char *pNameBuff); -MV_32 mvBoardPhyAddrGet(MV_U32 ethPortNum); -MV_BOARD_MAC_SPEED mvBoardMacSpeedGet(MV_U32 ethPortNum); -MV_32 mvBoardLinkStatusIrqGet(MV_U32 ethPortNum); -MV_32 mvBoardSwitchPortGet(MV_U32 ethPortNum, MV_U8 boardPortNum); -MV_32 mvBoardSwitchCpuPortGet(MV_U32 ethPortNum); -MV_32 mvBoardIsSwitchConnected(MV_U32 ethPortNum); -MV_32 mvBoardSmiScanModeGet(MV_U32 ethPortNum); -MV_BOOL mvBoardIsPortInSgmii(MV_U32 ethPortNum); -MV_BOOL mvBoardIsPortInGmii(MV_VOID); -MV_U32 mvBoardTclkGet(MV_VOID); -MV_U32 mvBoardSysClkGet(MV_VOID); -MV_U32 mvBoardDebugLedNumGet(MV_U32 boardId); -MV_VOID mvBoardDebugLed(MV_U32 hexNum); -MV_32 mvBoardMppGet(MV_U32 mppGroupNum); - -MV_U8 mvBoardRtcTwsiAddrTypeGet(MV_VOID); -MV_U8 mvBoardRtcTwsiAddrGet(MV_VOID); - -MV_U8 mvBoardA2DTwsiAddrTypeGet(MV_VOID); -MV_U8 mvBoardA2DTwsiAddrGet(MV_VOID); - -MV_U8 mvBoardTwsiExpAddrGet(MV_U32 index); -MV_U8 mvBoardTwsiSatRAddrTypeGet(MV_U32 index); -MV_U8 mvBoardTwsiSatRAddrGet(MV_U32 index); -MV_U8 mvBoardTwsiExpAddrTypeGet(MV_U32 index); -MV_BOARD_MODULE_ID_CLASS mvBoarModuleTypeGet(MV_BOARD_MPP_GROUP_CLASS devClass); -MV_BOARD_MPP_TYPE_CLASS mvBoardMppGroupTypeGet(MV_BOARD_MPP_GROUP_CLASS mppGroupClass); -MV_VOID mvBoardMppGroupTypeSet(MV_BOARD_MPP_GROUP_CLASS mppGroupClass, - MV_BOARD_MPP_TYPE_CLASS mppGroupType); -MV_VOID mvBoardMppGroupIdUpdate(MV_VOID); -MV_VOID mvBoardMppMuxSet(MV_VOID); -MV_VOID mvBoardTdmMppSet(MV_32 chType); -MV_VOID mvBoardVoiceConnModeGet(MV_32* connMode, MV_32* irqMode); - -MV_VOID mvBoardMppModuleTypePrint(MV_VOID); -MV_VOID mvBoardReset(MV_VOID); -MV_U8 mvBoarTwsiSatRGet(MV_U8 devNum, MV_U8 regNum); -MV_STATUS mvBoarTwsiSatRSet(MV_U8 devNum, MV_U8 regNum, MV_U8 regVal); -MV_BOOL mvBoardSpecInitGet(MV_U32* regOff, MV_U32* data); -/* Board devices API managments */ -MV_32 mvBoardGetDevicesNumber(MV_BOARD_DEV_CLASS devClass); -MV_32 mvBoardGetDeviceBaseAddr(MV_32 devNum, MV_BOARD_DEV_CLASS devClass); -MV_32 mvBoardGetDeviceBusWidth(MV_32 devNum, MV_BOARD_DEV_CLASS devClass); -MV_32 mvBoardGetDeviceWidth(MV_32 devNum, MV_BOARD_DEV_CLASS devClass); -MV_32 mvBoardGetDeviceWinSize(MV_32 devNum, MV_BOARD_DEV_CLASS devClass); -MV_U32 boardGetDevCSNum(MV_32 devNum, MV_BOARD_DEV_CLASS devClass); - -/* Gpio Pin Connections API */ -MV_32 mvBoardUSBVbusGpioPinGet(int devId); -MV_32 mvBoardUSBVbusEnGpioPinGet(int devId); -MV_U32 mvBoardPexBridgeIntPinGet(MV_U32 devNum, MV_U32 intPin); - -MV_32 mvBoardResetGpioPinGet(MV_VOID); -MV_32 mvBoardRTCGpioPinGet(MV_VOID); -MV_32 mvBoardGpioIntMaskLowGet(MV_VOID); -MV_32 mvBoardGpioIntMaskHighGet(MV_VOID); -MV_32 mvBoardSlicGpioPinGet(MV_U32 slicNum); - -MV_32 mvBoardSDIOGpioPinGet(MV_VOID); -MV_STATUS mvBoardSDioWPControl(MV_BOOL mode); -MV_32 mvBoarGpioPinNumGet(MV_BOARD_GPP_CLASS class, MV_U32 index); - -MV_32 mvBoardNandWidthGet(void); -MV_STATUS mvBoardFanPowerControl(MV_BOOL mode); -MV_STATUS mvBoardHDDPowerControl(MV_BOOL mode); -#endif /* __INCmvBoardEnvLibh */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvSpec.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvSpec.c deleted file mode 100644 index e256c4f709..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvSpec.c +++ /dev/null @@ -1,848 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ -#include "mvCommon.h" -#include "mvBoardEnvLib.h" -#include "mvBoardEnvSpec.h" -#include "twsi/mvTwsi.h" - -#define DB_88F6281A_BOARD_PCI_IF_NUM 0x0 -#define DB_88F6281A_BOARD_TWSI_DEF_NUM 0x7 -#define DB_88F6281A_BOARD_MAC_INFO_NUM 0x2 -#define DB_88F6281A_BOARD_GPP_INFO_NUM 0x3 -#define DB_88F6281A_BOARD_MPP_CONFIG_NUM 0x1 -#define DB_88F6281A_BOARD_MPP_GROUP_TYPE_NUM 0x1 -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - #define DB_88F6281A_BOARD_DEVICE_CONFIG_NUM 0x1 -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - #define DB_88F6281A_BOARD_DEVICE_CONFIG_NUM 0x2 -#else - #define DB_88F6281A_BOARD_DEVICE_CONFIG_NUM 0x1 -#endif -#define DB_88F6281A_BOARD_DEBUG_LED_NUM 0x0 - - -MV_BOARD_TWSI_INFO db88f6281AInfoBoardTwsiDev[] = - /* {{MV_BOARD_DEV_CLASS devClass, MV_U8 twsiDevAddr, MV_U8 twsiDevAddrType}} */ - { - {BOARD_DEV_TWSI_EXP, 0x20, ADDR7_BIT}, - {BOARD_DEV_TWSI_EXP, 0x21, ADDR7_BIT}, - {BOARD_DEV_TWSI_EXP, 0x27, ADDR7_BIT}, - {BOARD_DEV_TWSI_SATR, 0x4C, ADDR7_BIT}, - {BOARD_DEV_TWSI_SATR, 0x4D, ADDR7_BIT}, - {BOARD_DEV_TWSI_SATR, 0x4E, ADDR7_BIT}, - {BOARD_TWSI_AUDIO_DEC, 0x4A, ADDR7_BIT} - }; - -MV_BOARD_MAC_INFO db88f6281AInfoBoardMacInfo[] = - /* {{MV_BOARD_MAC_SPEED boardMacSpeed, MV_U8 boardEthSmiAddr}} */ - { - {BOARD_MAC_SPEED_AUTO, 0x8}, - {BOARD_MAC_SPEED_AUTO, 0x9} - }; - -MV_BOARD_MPP_TYPE_INFO db88f6281AInfoBoardMppTypeInfo[] = - /* {{MV_BOARD_MPP_TYPE_CLASS boardMppGroup1, - MV_BOARD_MPP_TYPE_CLASS boardMppGroup2}} */ - {{MV_BOARD_AUTO, MV_BOARD_AUTO} - }; - -MV_BOARD_GPP_INFO db88f6281AInfoBoardGppInfo[] = - /* {{MV_BOARD_GPP_CLASS devClass, MV_U8 gppPinNum}} */ - { - {BOARD_GPP_TSU_DIRCTION, 33} - /*muxed with TDM/Audio module via IOexpender - {BOARD_GPP_SDIO_DETECT, 38}, - {BOARD_GPP_USB_VBUS, 49}*/ - }; - -MV_DEV_CS_INFO db88f6281AInfoBoardDeCsInfo[] = - /*{deviceCS, params, devType, devWidth}*/ -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - {{0, N_A, BOARD_DEV_NAND_FLASH, 8}}; /* NAND DEV */ -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - { - {0, N_A, BOARD_DEV_NAND_FLASH, 8}, /* NAND DEV */ - {1, N_A, BOARD_DEV_SPI_FLASH, 8}, /* SPI DEV */ - }; -#else - {{1, N_A, BOARD_DEV_SPI_FLASH, 8}}; /* SPI DEV */ -#endif - -MV_BOARD_MPP_INFO db88f6281AInfoBoardMppConfigValue[] = - {{{ - DB_88F6281A_MPP0_7, - DB_88F6281A_MPP8_15, - DB_88F6281A_MPP16_23, - DB_88F6281A_MPP24_31, - DB_88F6281A_MPP32_39, - DB_88F6281A_MPP40_47, - DB_88F6281A_MPP48_55 - }}}; - - -MV_BOARD_INFO db88f6281AInfo = { - "DB-88F6281A-BP", /* boardName[MAX_BOARD_NAME_LEN] */ - DB_88F6281A_BOARD_MPP_GROUP_TYPE_NUM, /* numBoardMppGroupType */ - db88f6281AInfoBoardMppTypeInfo, - DB_88F6281A_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - db88f6281AInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - 0, /* intsGppMaskHigh */ - DB_88F6281A_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - db88f6281AInfoBoardDeCsInfo, - DB_88F6281A_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - db88f6281AInfoBoardTwsiDev, - DB_88F6281A_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - db88f6281AInfoBoardMacInfo, - DB_88F6281A_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - db88f6281AInfoBoardGppInfo, - DB_88F6281A_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - NULL, - 0, /* ledsPolarity */ - DB_88F6281A_OE_LOW, /* gppOutEnLow */ - DB_88F6281A_OE_HIGH, /* gppOutEnHigh */ - DB_88F6281A_OE_VAL_LOW, /* gppOutValLow */ - DB_88F6281A_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - BIT6, /* gppPolarityValHigh */ - NULL /* pSwitchInfo */ -}; - - -#define RD_88F6281A_BOARD_PCI_IF_NUM 0x0 -#define RD_88F6281A_BOARD_TWSI_DEF_NUM 0x2 -#define RD_88F6281A_BOARD_MAC_INFO_NUM 0x2 -#define RD_88F6281A_BOARD_GPP_INFO_NUM 0x5 -#define RD_88F6281A_BOARD_MPP_GROUP_TYPE_NUM 0x1 -#define RD_88F6281A_BOARD_MPP_CONFIG_NUM 0x1 -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - #define RD_88F6281A_BOARD_DEVICE_CONFIG_NUM 0x1 -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - #define RD_88F6281A_BOARD_DEVICE_CONFIG_NUM 0x2 -#else - #define RD_88F6281A_BOARD_DEVICE_CONFIG_NUM 0x1 -#endif -#define RD_88F6281A_BOARD_DEBUG_LED_NUM 0x0 - -MV_BOARD_MAC_INFO rd88f6281AInfoBoardMacInfo[] = - /* {{MV_BOARD_MAC_SPEED boardMacSpeed, MV_U8 boardEthSmiAddr}} */ - {{BOARD_MAC_SPEED_1000M, 0xa}, - {BOARD_MAC_SPEED_AUTO, 0xb} - }; - -MV_BOARD_SWITCH_INFO rd88f6281AInfoBoardSwitchInfo[] = - /* MV_32 linkStatusIrq, {MV_32 qdPort0, MV_32 qdPort1, MV_32 qdPort2, MV_32 qdPort3, MV_32 qdPort4}, - MV_32 qdCpuPort, MV_32 smiScanMode, MV_32 switchOnPort} */ - {{38, {0, 1, 2, 3, -1}, 5, 2, 0}, - {-1, {-1}, -1, -1, -1}}; - -MV_BOARD_TWSI_INFO rd88f6281AInfoBoardTwsiDev[] = - /* {{MV_BOARD_DEV_CLASS devClass, MV_U8 twsiDevAddr, MV_U8 twsiDevAddrType}} */ - { - {BOARD_DEV_TWSI_EXP, 0xFF, ADDR7_BIT}, /* dummy entry to align with modules indexes */ - {BOARD_DEV_TWSI_EXP, 0x27, ADDR7_BIT} - }; - -MV_BOARD_MPP_TYPE_INFO rd88f6281AInfoBoardMppTypeInfo[] = - {{MV_BOARD_RGMII, MV_BOARD_TDM} - }; - -MV_DEV_CS_INFO rd88f6281AInfoBoardDeCsInfo[] = - /*{deviceCS, params, devType, devWidth}*/ -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - {{0, N_A, BOARD_DEV_NAND_FLASH, 8}}; /* NAND DEV */ -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - { - {0, N_A, BOARD_DEV_NAND_FLASH, 8}, /* NAND DEV */ - {1, N_A, BOARD_DEV_SPI_FLASH, 8}, /* SPI DEV */ - }; -#else - {{1, N_A, BOARD_DEV_SPI_FLASH, 8}}; /* SPI DEV */ -#endif - -MV_BOARD_GPP_INFO rd88f6281AInfoBoardGppInfo[] = - /* {{MV_BOARD_GPP_CLASS devClass, MV_U8 gppPinNum}} */ - {{BOARD_GPP_SDIO_DETECT, 28}, - {BOARD_GPP_USB_OC, 29}, - {BOARD_GPP_WPS_BUTTON, 35}, - {BOARD_GPP_MV_SWITCH, 38}, - {BOARD_GPP_USB_VBUS, 49} - }; - -MV_BOARD_MPP_INFO rd88f6281AInfoBoardMppConfigValue[] = - {{{ - RD_88F6281A_MPP0_7, - RD_88F6281A_MPP8_15, - RD_88F6281A_MPP16_23, - RD_88F6281A_MPP24_31, - RD_88F6281A_MPP32_39, - RD_88F6281A_MPP40_47, - RD_88F6281A_MPP48_55 - }}}; - -MV_BOARD_INFO rd88f6281AInfo = { - "RD-88F6281A", /* boardName[MAX_BOARD_NAME_LEN] */ - RD_88F6281A_BOARD_MPP_GROUP_TYPE_NUM, /* numBoardMppGroupType */ - rd88f6281AInfoBoardMppTypeInfo, - RD_88F6281A_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - rd88f6281AInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - (1 << 3), /* intsGppMaskHigh */ - RD_88F6281A_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - rd88f6281AInfoBoardDeCsInfo, - RD_88F6281A_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - rd88f6281AInfoBoardTwsiDev, - RD_88F6281A_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - rd88f6281AInfoBoardMacInfo, - RD_88F6281A_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - rd88f6281AInfoBoardGppInfo, - RD_88F6281A_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - NULL, - 0, /* ledsPolarity */ - RD_88F6281A_OE_LOW, /* gppOutEnLow */ - RD_88F6281A_OE_HIGH, /* gppOutEnHigh */ - RD_88F6281A_OE_VAL_LOW, /* gppOutValLow */ - RD_88F6281A_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - BIT6, /* gppPolarityValHigh */ - rd88f6281AInfoBoardSwitchInfo /* pSwitchInfo */ -}; - - -#define DB_88F6192A_BOARD_PCI_IF_NUM 0x0 -#define DB_88F6192A_BOARD_TWSI_DEF_NUM 0x7 -#define DB_88F6192A_BOARD_MAC_INFO_NUM 0x2 -#define DB_88F6192A_BOARD_GPP_INFO_NUM 0x3 -#define DB_88F6192A_BOARD_MPP_GROUP_TYPE_NUM 0x1 -#define DB_88F6192A_BOARD_MPP_CONFIG_NUM 0x1 -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - #define DB_88F6192A_BOARD_DEVICE_CONFIG_NUM 0x1 -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - #define DB_88F6192A_BOARD_DEVICE_CONFIG_NUM 0x2 -#else - #define DB_88F6192A_BOARD_DEVICE_CONFIG_NUM 0x1 -#endif -#define DB_88F6192A_BOARD_DEBUG_LED_NUM 0x0 - -MV_BOARD_TWSI_INFO db88f6192AInfoBoardTwsiDev[] = - /* {{MV_BOARD_DEV_CLASS devClass, MV_U8 twsiDevAddr, MV_U8 twsiDevAddrType}} */ - { - {BOARD_DEV_TWSI_EXP, 0x20, ADDR7_BIT}, - {BOARD_DEV_TWSI_EXP, 0x21, ADDR7_BIT}, - {BOARD_DEV_TWSI_EXP, 0x27, ADDR7_BIT}, - {BOARD_DEV_TWSI_SATR, 0x4C, ADDR7_BIT}, - {BOARD_DEV_TWSI_SATR, 0x4D, ADDR7_BIT}, - {BOARD_DEV_TWSI_SATR, 0x4E, ADDR7_BIT}, - {BOARD_TWSI_AUDIO_DEC, 0x4A, ADDR7_BIT} - }; - -MV_BOARD_MAC_INFO db88f6192AInfoBoardMacInfo[] = - /* {{MV_BOARD_MAC_SPEED boardMacSpeed, MV_U8 boardEthSmiAddr}} */ - { - {BOARD_MAC_SPEED_AUTO, 0x8}, - {BOARD_MAC_SPEED_AUTO, 0x9} - }; - -MV_BOARD_MPP_TYPE_INFO db88f6192AInfoBoardMppTypeInfo[] = - /* {{MV_BOARD_MPP_TYPE_CLASS boardMppGroup1, - MV_BOARD_MPP_TYPE_CLASS boardMppGroup2}} */ - {{MV_BOARD_AUTO, MV_BOARD_OTHER} - }; - -MV_DEV_CS_INFO db88f6192AInfoBoardDeCsInfo[] = - /*{deviceCS, params, devType, devWidth}*/ -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - {{0, N_A, BOARD_DEV_NAND_FLASH, 8}}; /* NAND DEV */ -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - { - {0, N_A, BOARD_DEV_NAND_FLASH, 8}, /* NAND DEV */ - {1, N_A, BOARD_DEV_SPI_FLASH, 8}, /* SPI DEV */ - }; -#else - {{1, N_A, BOARD_DEV_SPI_FLASH, 8}}; /* SPI DEV */ -#endif - -MV_BOARD_GPP_INFO db88f6192AInfoBoardGppInfo[] = - /* {{MV_BOARD_GPP_CLASS devClass, MV_U8 gppPinNum}} */ - { - {BOARD_GPP_SDIO_WP, 20}, - {BOARD_GPP_USB_VBUS, 22}, - {BOARD_GPP_SDIO_DETECT, 23}, - }; - -MV_BOARD_MPP_INFO db88f6192AInfoBoardMppConfigValue[] = - {{{ - DB_88F6192A_MPP0_7, - DB_88F6192A_MPP8_15, - DB_88F6192A_MPP16_23, - DB_88F6192A_MPP24_31, - DB_88F6192A_MPP32_35 - }}}; - -MV_BOARD_INFO db88f6192AInfo = { - "DB-88F6192A-BP", /* boardName[MAX_BOARD_NAME_LEN] */ - DB_88F6192A_BOARD_MPP_GROUP_TYPE_NUM, /* numBoardMppGroupType */ - db88f6192AInfoBoardMppTypeInfo, - DB_88F6192A_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - db88f6192AInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - (1 << 3), /* intsGppMaskHigh */ - DB_88F6192A_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - db88f6192AInfoBoardDeCsInfo, - DB_88F6192A_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - db88f6192AInfoBoardTwsiDev, - DB_88F6192A_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - db88f6192AInfoBoardMacInfo, - DB_88F6192A_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - db88f6192AInfoBoardGppInfo, - DB_88F6192A_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - NULL, - 0, /* ledsPolarity */ - DB_88F6192A_OE_LOW, /* gppOutEnLow */ - DB_88F6192A_OE_HIGH, /* gppOutEnHigh */ - DB_88F6192A_OE_VAL_LOW, /* gppOutValLow */ - DB_88F6192A_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - 0, /* gppPolarityValHigh */ - NULL /* pSwitchInfo */ -}; - -#define DB_88F6190A_BOARD_MAC_INFO_NUM 0x1 - -MV_BOARD_INFO db88f6190AInfo = { - "DB-88F6190A-BP", /* boardName[MAX_BOARD_NAME_LEN] */ - DB_88F6192A_BOARD_MPP_GROUP_TYPE_NUM, /* numBoardMppGroupType */ - db88f6192AInfoBoardMppTypeInfo, - DB_88F6192A_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - db88f6192AInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - (1 << 3), /* intsGppMaskHigh */ - DB_88F6192A_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - db88f6192AInfoBoardDeCsInfo, - DB_88F6192A_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - db88f6192AInfoBoardTwsiDev, - DB_88F6190A_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - db88f6192AInfoBoardMacInfo, - DB_88F6192A_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - db88f6192AInfoBoardGppInfo, - DB_88F6192A_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - NULL, - 0, /* ledsPolarity */ - DB_88F6192A_OE_LOW, /* gppOutEnLow */ - DB_88F6192A_OE_HIGH, /* gppOutEnHigh */ - DB_88F6192A_OE_VAL_LOW, /* gppOutValLow */ - DB_88F6192A_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - 0, /* gppPolarityValHigh */ - NULL /* pSwitchInfo */ -}; - -#define RD_88F6192A_BOARD_PCI_IF_NUM 0x0 -#define RD_88F6192A_BOARD_TWSI_DEF_NUM 0x0 -#define RD_88F6192A_BOARD_MAC_INFO_NUM 0x1 -#define RD_88F6192A_BOARD_GPP_INFO_NUM 0xE -#define RD_88F6192A_BOARD_MPP_GROUP_TYPE_NUM 0x1 -#define RD_88F6192A_BOARD_MPP_CONFIG_NUM 0x1 -#define RD_88F6192A_BOARD_DEVICE_CONFIG_NUM 0x1 -#define RD_88F6192A_BOARD_DEBUG_LED_NUM 0x3 - -MV_U8 rd88f6192AInfoBoardDebugLedIf[] = - {17, 28, 29}; - -MV_BOARD_MAC_INFO rd88f6192AInfoBoardMacInfo[] = - /* {{MV_BOARD_MAC_SPEED boardMacSpeed, MV_U8 boardEthSmiAddr}} */ - {{BOARD_MAC_SPEED_AUTO, 0x8} - }; - -MV_BOARD_MPP_TYPE_INFO rd88f6192AInfoBoardMppTypeInfo[] = - /* {{MV_BOARD_MPP_TYPE_CLASS boardMppGroup1, - MV_BOARD_MPP_TYPE_CLASS boardMppGroup2}} */ - {{MV_BOARD_OTHER, MV_BOARD_OTHER} - }; - -MV_DEV_CS_INFO rd88f6192AInfoBoardDeCsInfo[] = - /*{deviceCS, params, devType, devWidth}*/ - {{1, N_A, BOARD_DEV_SPI_FLASH, 8}}; /* SPI DEV */ - -MV_BOARD_GPP_INFO rd88f6192AInfoBoardGppInfo[] = - /* {{MV_BOARD_GPP_CLASS devClass, MV_U8 gppPinNum}} */ - { - {BOARD_GPP_USB_VBUS_EN, 10}, - {BOARD_GPP_USB_HOST_DEVICE, 11}, - {BOARD_GPP_RESET, 14}, - {BOARD_GPP_POWER_ON_LED, 15}, - {BOARD_GPP_HDD_POWER, 16}, - {BOARD_GPP_WPS_BUTTON, 24}, - {BOARD_GPP_TS_BUTTON_C, 25}, - {BOARD_GPP_USB_VBUS, 26}, - {BOARD_GPP_USB_OC, 27}, - {BOARD_GPP_TS_BUTTON_U, 30}, - {BOARD_GPP_TS_BUTTON_R, 31}, - {BOARD_GPP_TS_BUTTON_L, 32}, - {BOARD_GPP_TS_BUTTON_D, 34}, - {BOARD_GPP_FAN_POWER, 35} - }; - -MV_BOARD_MPP_INFO rd88f6192AInfoBoardMppConfigValue[] = - {{{ - RD_88F6192A_MPP0_7, - RD_88F6192A_MPP8_15, - RD_88F6192A_MPP16_23, - RD_88F6192A_MPP24_31, - RD_88F6192A_MPP32_35 - }}}; - -MV_BOARD_INFO rd88f6192AInfo = { - "RD-88F6192A-NAS", /* boardName[MAX_BOARD_NAME_LEN] */ - RD_88F6192A_BOARD_MPP_GROUP_TYPE_NUM, /* numBoardMppGroupType */ - rd88f6192AInfoBoardMppTypeInfo, - RD_88F6192A_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - rd88f6192AInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - (1 << 3), /* intsGppMaskHigh */ - RD_88F6192A_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - rd88f6192AInfoBoardDeCsInfo, - RD_88F6192A_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - NULL, - RD_88F6192A_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - rd88f6192AInfoBoardMacInfo, - RD_88F6192A_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - rd88f6192AInfoBoardGppInfo, - RD_88F6192A_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - rd88f6192AInfoBoardDebugLedIf, - 0, /* ledsPolarity */ - RD_88F6192A_OE_LOW, /* gppOutEnLow */ - RD_88F6192A_OE_HIGH, /* gppOutEnHigh */ - RD_88F6192A_OE_VAL_LOW, /* gppOutValLow */ - RD_88F6192A_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - 0, /* gppPolarityValHigh */ - NULL /* pSwitchInfo */ -}; - -MV_BOARD_INFO rd88f6190AInfo = { - "RD-88F6190A-NAS", /* boardName[MAX_BOARD_NAME_LEN] */ - RD_88F6192A_BOARD_MPP_GROUP_TYPE_NUM, /* numBoardMppGroupType */ - rd88f6192AInfoBoardMppTypeInfo, - RD_88F6192A_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - rd88f6192AInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - (1 << 3), /* intsGppMaskHigh */ - RD_88F6192A_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - rd88f6192AInfoBoardDeCsInfo, - RD_88F6192A_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - NULL, - RD_88F6192A_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - rd88f6192AInfoBoardMacInfo, - RD_88F6192A_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - rd88f6192AInfoBoardGppInfo, - RD_88F6192A_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - rd88f6192AInfoBoardDebugLedIf, - 0, /* ledsPolarity */ - RD_88F6192A_OE_LOW, /* gppOutEnLow */ - RD_88F6192A_OE_HIGH, /* gppOutEnHigh */ - RD_88F6192A_OE_VAL_LOW, /* gppOutValLow */ - RD_88F6192A_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - 0, /* gppPolarityValHigh */ - NULL /* pSwitchInfo */ -}; - -#define DB_88F6180A_BOARD_PCI_IF_NUM 0x0 -#define DB_88F6180A_BOARD_TWSI_DEF_NUM 0x5 -#define DB_88F6180A_BOARD_MAC_INFO_NUM 0x1 -#define DB_88F6180A_BOARD_GPP_INFO_NUM 0x0 -#define DB_88F6180A_BOARD_MPP_GROUP_TYPE_NUM 0x2 -#define DB_88F6180A_BOARD_MPP_CONFIG_NUM 0x1 -#define DB_88F6180A_BOARD_DEVICE_CONFIG_NUM 0x1 -#define DB_88F6180A_BOARD_DEBUG_LED_NUM 0x0 - -MV_BOARD_TWSI_INFO db88f6180AInfoBoardTwsiDev[] = - /* {{MV_BOARD_DEV_CLASS devClass, MV_U8 twsiDevAddr, MV_U8 twsiDevAddrType}} */ - { - {BOARD_DEV_TWSI_EXP, 0x20, ADDR7_BIT}, - {BOARD_DEV_TWSI_EXP, 0x21, ADDR7_BIT}, - {BOARD_DEV_TWSI_EXP, 0x27, ADDR7_BIT}, - {BOARD_DEV_TWSI_SATR, 0x4C, ADDR7_BIT}, - {BOARD_TWSI_AUDIO_DEC, 0x4A, ADDR7_BIT} - }; - -MV_BOARD_MAC_INFO db88f6180AInfoBoardMacInfo[] = - /* {{MV_BOARD_MAC_SPEED boardMacSpeed, MV_U8 boardEthSmiAddr}} */ - {{BOARD_MAC_SPEED_AUTO, 0x8} - }; - -MV_BOARD_GPP_INFO db88f6180AInfoBoardGppInfo[] = - /* {{MV_BOARD_GPP_CLASS devClass, MV_U8 gppPinNum}} */ - { - /* Muxed with TDM/Audio module via IOexpender - {BOARD_GPP_USB_VBUS, 6} */ - }; - -MV_BOARD_MPP_TYPE_INFO db88f6180AInfoBoardMppTypeInfo[] = - /* {{MV_BOARD_MPP_TYPE_CLASS boardMppGroup1, - MV_BOARD_MPP_TYPE_CLASS boardMppGroup2}} */ - {{MV_BOARD_OTHER, MV_BOARD_AUTO} - }; - -MV_DEV_CS_INFO db88f6180AInfoBoardDeCsInfo[] = - /*{deviceCS, params, devType, devWidth}*/ -#if defined(MV_NAND_BOOT) - {{0, N_A, BOARD_DEV_NAND_FLASH, 8}}; /* NAND DEV */ -#else - {{1, N_A, BOARD_DEV_SPI_FLASH, 8}}; /* SPI DEV */ -#endif - -MV_BOARD_MPP_INFO db88f6180AInfoBoardMppConfigValue[] = - {{{ - DB_88F6180A_MPP0_7, - DB_88F6180A_MPP8_15, - DB_88F6180A_MPP16_23, - DB_88F6180A_MPP24_31, - DB_88F6180A_MPP32_39, - DB_88F6180A_MPP40_44 - }}}; - -MV_BOARD_INFO db88f6180AInfo = { - "DB-88F6180A-BP", /* boardName[MAX_BOARD_NAME_LEN] */ - DB_88F6180A_BOARD_MPP_GROUP_TYPE_NUM, /* numBoardMppGroupType */ - db88f6180AInfoBoardMppTypeInfo, - DB_88F6180A_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - db88f6180AInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - 0, /* intsGppMaskHigh */ - DB_88F6180A_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - db88f6180AInfoBoardDeCsInfo, - DB_88F6180A_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - db88f6180AInfoBoardTwsiDev, - DB_88F6180A_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - db88f6180AInfoBoardMacInfo, - DB_88F6180A_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - NULL, - DB_88F6180A_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - NULL, - 0, /* ledsPolarity */ - DB_88F6180A_OE_LOW, /* gppOutEnLow */ - DB_88F6180A_OE_HIGH, /* gppOutEnHigh */ - DB_88F6180A_OE_VAL_LOW, /* gppOutValLow */ - DB_88F6180A_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - 0, /* gppPolarityValHigh */ - NULL /* pSwitchInfo */ -}; - - -#define RD_88F6281A_PCAC_BOARD_PCI_IF_NUM 0x0 -#define RD_88F6281A_PCAC_BOARD_TWSI_DEF_NUM 0x1 -#define RD_88F6281A_PCAC_BOARD_MAC_INFO_NUM 0x1 -#define RD_88F6281A_PCAC_BOARD_GPP_INFO_NUM 0x0 -#define RD_88F6281A_PCAC_BOARD_MPP_GROUP_TYPE_NUM 0x1 -#define RD_88F6281A_PCAC_BOARD_MPP_CONFIG_NUM 0x1 -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - #define RD_88F6281A_PCAC_BOARD_DEVICE_CONFIG_NUM 0x1 -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - #define RD_88F6281A_PCAC_BOARD_DEVICE_CONFIG_NUM 0x2 -#else - #define RD_88F6281A_PCAC_BOARD_DEVICE_CONFIG_NUM 0x1 -#endif -#define RD_88F6281A_PCAC_BOARD_DEBUG_LED_NUM 0x4 - -MV_U8 rd88f6281APcacInfoBoardDebugLedIf[] = - {38, 39, 40, 41}; - -MV_BOARD_MAC_INFO rd88f6281APcacInfoBoardMacInfo[] = - /* {{MV_BOARD_MAC_SPEED boardMacSpeed, MV_U8 boardEthSmiAddr}} */ - {{BOARD_MAC_SPEED_AUTO, 0x8} - }; - -MV_BOARD_TWSI_INFO rd88f6281APcacInfoBoardTwsiDev[] = - /* {{MV_BOARD_DEV_CLASS devClass, MV_U8 twsiDevAddr, MV_U8 twsiDevAddrType}} */ - { - {BOARD_TWSI_OTHER, 0xa7, ADDR7_BIT} - }; - -MV_BOARD_MPP_TYPE_INFO rd88f6281APcacInfoBoardMppTypeInfo[] = - {{MV_BOARD_OTHER, MV_BOARD_OTHER} - }; - -MV_DEV_CS_INFO rd88f6281APcacInfoBoardDeCsInfo[] = - /*{deviceCS, params, devType, devWidth}*/ -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - {{0, N_A, BOARD_DEV_NAND_FLASH, 8}}; /* NAND DEV */ -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - { - {0, N_A, BOARD_DEV_NAND_FLASH, 8}, /* NAND DEV */ - {1, N_A, BOARD_DEV_SPI_FLASH, 8}, /* SPI DEV */ - }; -#else - {{1, N_A, BOARD_DEV_SPI_FLASH, 8}}; /* SPI DEV */ -#endif - -MV_BOARD_MPP_INFO rd88f6281APcacInfoBoardMppConfigValue[] = - {{{ - RD_88F6281A_PCAC_MPP0_7, - RD_88F6281A_PCAC_MPP8_15, - RD_88F6281A_PCAC_MPP16_23, - RD_88F6281A_PCAC_MPP24_31, - RD_88F6281A_PCAC_MPP32_39, - RD_88F6281A_PCAC_MPP40_47, - RD_88F6281A_PCAC_MPP48_55 - }}}; - -MV_BOARD_INFO rd88f6281APcacInfo = { - "RD-88F6281A-PCAC", /* boardName[MAX_BOARD_NAME_LEN] */ - RD_88F6281A_PCAC_BOARD_MPP_GROUP_TYPE_NUM, /* numBoardMppGroupType */ - rd88f6281APcacInfoBoardMppTypeInfo, - RD_88F6281A_PCAC_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - rd88f6281APcacInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - (1 << 3), /* intsGppMaskHigh */ - RD_88F6281A_PCAC_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - rd88f6281APcacInfoBoardDeCsInfo, - RD_88F6281A_PCAC_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - rd88f6281APcacInfoBoardTwsiDev, - RD_88F6281A_PCAC_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - rd88f6281APcacInfoBoardMacInfo, - RD_88F6281A_PCAC_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - 0, - RD_88F6281A_PCAC_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - NULL, - 0, /* ledsPolarity */ - RD_88F6281A_PCAC_OE_LOW, /* gppOutEnLow */ - RD_88F6281A_PCAC_OE_HIGH, /* gppOutEnHigh */ - RD_88F6281A_PCAC_OE_VAL_LOW, /* gppOutValLow */ - RD_88F6281A_PCAC_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - 0, /* gppPolarityValHigh */ - NULL /* pSwitchInfo */ -}; - - -/* 6281 Sheeva Plug*/ - -#define SHEEVA_PLUG_BOARD_PCI_IF_NUM 0x0 -#define SHEEVA_PLUG_BOARD_TWSI_DEF_NUM 0x0 -#define SHEEVA_PLUG_BOARD_MAC_INFO_NUM 0x1 -#define SHEEVA_PLUG_BOARD_GPP_INFO_NUM 0x0 -#define SHEEVA_PLUG_BOARD_MPP_GROUP_TYPE_NUN 0x1 -#define SHEEVA_PLUG_BOARD_MPP_CONFIG_NUM 0x1 -#define SHEEVA_PLUG_BOARD_DEVICE_CONFIG_NUM 0x1 -#define SHEEVA_PLUG_BOARD_DEBUG_LED_NUM 0x1 - -MV_U8 sheevaPlugInfoBoardDebugLedIf[] = - {49}; - -MV_BOARD_MAC_INFO sheevaPlugInfoBoardMacInfo[] = - /* {{MV_BOARD_MAC_SPEED boardMacSpeed, MV_U8 boardEthSmiAddr}} */ - {{BOARD_MAC_SPEED_AUTO, 0x0}}; - -MV_BOARD_TWSI_INFO sheevaPlugInfoBoardTwsiDev[] = - /* {{MV_BOARD_DEV_CLASS devClass, MV_U8 twsiDevAddr, MV_U8 twsiDevAddrType}} */ - {{BOARD_TWSI_OTHER, 0x0, ADDR7_BIT}}; - -MV_BOARD_MPP_TYPE_INFO sheevaPlugInfoBoardMppTypeInfo[] = - {{MV_BOARD_OTHER, MV_BOARD_OTHER} - }; - -MV_DEV_CS_INFO sheevaPlugInfoBoardDeCsInfo[] = - /*{deviceCS, params, devType, devWidth}*/ - {{0, N_A, BOARD_DEV_NAND_FLASH, 8}}; /* NAND DEV */ - -MV_BOARD_MPP_INFO sheevaPlugInfoBoardMppConfigValue[] = - {{{ - RD_SHEEVA_PLUG_MPP0_7, - RD_SHEEVA_PLUG_MPP8_15, - RD_SHEEVA_PLUG_MPP16_23, - RD_SHEEVA_PLUG_MPP24_31, - RD_SHEEVA_PLUG_MPP32_39, - RD_SHEEVA_PLUG_MPP40_47, - RD_SHEEVA_PLUG_MPP48_55 - }}}; - -MV_BOARD_INFO sheevaPlugInfo = { - "SHEEVA PLUG", /* boardName[MAX_BOARD_NAME_LEN] */ - SHEEVA_PLUG_BOARD_MPP_GROUP_TYPE_NUN, /* numBoardMppGroupType */ - sheevaPlugInfoBoardMppTypeInfo, - SHEEVA_PLUG_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - sheevaPlugInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - 0, /* intsGppMaskHigh */ - SHEEVA_PLUG_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - sheevaPlugInfoBoardDeCsInfo, - SHEEVA_PLUG_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - sheevaPlugInfoBoardTwsiDev, - SHEEVA_PLUG_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - sheevaPlugInfoBoardMacInfo, - SHEEVA_PLUG_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - 0, - SHEEVA_PLUG_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - sheevaPlugInfoBoardDebugLedIf, - 0, /* ledsPolarity */ - RD_SHEEVA_PLUG_OE_LOW, /* gppOutEnLow */ - RD_SHEEVA_PLUG_OE_HIGH, /* gppOutEnHigh */ - RD_SHEEVA_PLUG_OE_VAL_LOW, /* gppOutValLow */ - RD_SHEEVA_PLUG_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - 0, /* gppPolarityValHigh */ - NULL /* pSwitchInfo */ -}; - -/* Customer specific board place holder*/ - -#define DB_CUSTOMER_BOARD_PCI_IF_NUM 0x0 -#define DB_CUSTOMER_BOARD_TWSI_DEF_NUM 0x0 -#define DB_CUSTOMER_BOARD_MAC_INFO_NUM 0x0 -#define DB_CUSTOMER_BOARD_GPP_INFO_NUM 0x0 -#define DB_CUSTOMER_BOARD_MPP_GROUP_TYPE_NUN 0x0 -#define DB_CUSTOMER_BOARD_MPP_CONFIG_NUM 0x0 -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - #define DB_CUSTOMER_BOARD_DEVICE_CONFIG_NUM 0x0 -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - #define DB_CUSTOMER_BOARD_DEVICE_CONFIG_NUM 0x0 -#else - #define DB_CUSTOMER_BOARD_DEVICE_CONFIG_NUM 0x0 -#endif -#define DB_CUSTOMER_BOARD_DEBUG_LED_NUM 0x0 - -MV_U8 dbCustomerInfoBoardDebugLedIf[] = - {0}; - -MV_BOARD_MAC_INFO dbCustomerInfoBoardMacInfo[] = - /* {{MV_BOARD_MAC_SPEED boardMacSpeed, MV_U8 boardEthSmiAddr}} */ - {{BOARD_MAC_SPEED_AUTO, 0x0}}; - -MV_BOARD_TWSI_INFO dbCustomerInfoBoardTwsiDev[] = - /* {{MV_BOARD_DEV_CLASS devClass, MV_U8 twsiDevAddr, MV_U8 twsiDevAddrType}} */ - {{BOARD_TWSI_OTHER, 0x0, ADDR7_BIT}}; - -MV_BOARD_MPP_TYPE_INFO dbCustomerInfoBoardMppTypeInfo[] = - {{MV_BOARD_OTHER, MV_BOARD_OTHER} - }; - -MV_DEV_CS_INFO dbCustomerInfoBoardDeCsInfo[] = - /*{deviceCS, params, devType, devWidth}*/ -#if defined(MV_NAND) && defined(MV_NAND_BOOT) - {{0, N_A, BOARD_DEV_NAND_FLASH, 8}}; /* NAND DEV */ -#elif defined(MV_NAND) && defined(MV_SPI_BOOT) - { - {0, N_A, BOARD_DEV_NAND_FLASH, 8}, /* NAND DEV */ - {2, N_A, BOARD_DEV_SPI_FLASH, 8}, /* SPI DEV */ - }; -#else - {{2, N_A, BOARD_DEV_SPI_FLASH, 8}}; /* SPI DEV */ -#endif - -MV_BOARD_MPP_INFO dbCustomerInfoBoardMppConfigValue[] = - {{{ - DB_CUSTOMER_MPP0_7, - DB_CUSTOMER_MPP8_15, - DB_CUSTOMER_MPP16_23, - DB_CUSTOMER_MPP24_31, - DB_CUSTOMER_MPP32_39, - DB_CUSTOMER_MPP40_47, - DB_CUSTOMER_MPP48_55 - }}}; - -MV_BOARD_INFO dbCustomerInfo = { - "DB-CUSTOMER", /* boardName[MAX_BOARD_NAME_LEN] */ - DB_CUSTOMER_BOARD_MPP_GROUP_TYPE_NUN, /* numBoardMppGroupType */ - dbCustomerInfoBoardMppTypeInfo, - DB_CUSTOMER_BOARD_MPP_CONFIG_NUM, /* numBoardMppConfig */ - dbCustomerInfoBoardMppConfigValue, - 0, /* intsGppMaskLow */ - 0, /* intsGppMaskHigh */ - DB_CUSTOMER_BOARD_DEVICE_CONFIG_NUM, /* numBoardDevIf */ - dbCustomerInfoBoardDeCsInfo, - DB_CUSTOMER_BOARD_TWSI_DEF_NUM, /* numBoardTwsiDev */ - dbCustomerInfoBoardTwsiDev, - DB_CUSTOMER_BOARD_MAC_INFO_NUM, /* numBoardMacInfo */ - dbCustomerInfoBoardMacInfo, - DB_CUSTOMER_BOARD_GPP_INFO_NUM, /* numBoardGppInfo */ - 0, - DB_CUSTOMER_BOARD_DEBUG_LED_NUM, /* activeLedsNumber */ - NULL, - 0, /* ledsPolarity */ - DB_CUSTOMER_OE_LOW, /* gppOutEnLow */ - DB_CUSTOMER_OE_HIGH, /* gppOutEnHigh */ - DB_CUSTOMER_OE_VAL_LOW, /* gppOutValLow */ - DB_CUSTOMER_OE_VAL_HIGH, /* gppOutValHigh */ - 0, /* gppPolarityValLow */ - 0, /* gppPolarityValHigh */ - NULL /* pSwitchInfo */ -}; - -MV_BOARD_INFO* boardInfoTbl[] = { - &db88f6281AInfo, - &rd88f6281AInfo, - &db88f6192AInfo, - &rd88f6192AInfo, - &db88f6180AInfo, - &db88f6190AInfo, - &rd88f6190AInfo, - &rd88f6281APcacInfo, - &dbCustomerInfo, - &sheevaPlugInfo - }; - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvSpec.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvSpec.h deleted file mode 100644 index 0372eee5dc..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/boardEnv/mvBoardEnvSpec.h +++ /dev/null @@ -1,262 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __INCmvBoardEnvSpech -#define __INCmvBoardEnvSpech - -#include "mvSysHwConfig.h" - - -/* For future use */ -#define BD_ID_DATA_START_OFFS 0x0 -#define BD_DETECT_SEQ_OFFS 0x0 -#define BD_SYS_NUM_OFFS 0x4 -#define BD_NAME_OFFS 0x8 - -/* I2C bus addresses */ -#define MV_BOARD_CTRL_I2C_ADDR 0x0 /* Controller slave addr */ -#define MV_BOARD_CTRL_I2C_ADDR_TYPE ADDR7_BIT -#define MV_BOARD_DIMM0_I2C_ADDR 0x56 -#define MV_BOARD_DIMM0_I2C_ADDR_TYPE ADDR7_BIT -#define MV_BOARD_DIMM1_I2C_ADDR 0x54 -#define MV_BOARD_DIMM1_I2C_ADDR_TYPE ADDR7_BIT -#define MV_BOARD_EEPROM_I2C_ADDR 0x51 -#define MV_BOARD_EEPROM_I2C_ADDR_TYPE ADDR7_BIT -#define MV_BOARD_MAIN_EEPROM_I2C_ADDR 0x50 -#define MV_BOARD_MAIN_EEPROM_I2C_ADDR_TYPE ADDR7_BIT -#define MV_BOARD_MUX_I2C_ADDR_ENTRY 0x2 -#define MV_BOARD_DIMM_I2C_CHANNEL 0x0 - -#define BOOT_FLASH_INDEX 0 -#define MAIN_FLASH_INDEX 1 - -#define BOARD_ETH_START_PORT_NUM 0 - -/* Supported clocks */ -#define MV_BOARD_TCLK_100MHZ 100000000 -#define MV_BOARD_TCLK_125MHZ 125000000 -#define MV_BOARD_TCLK_133MHZ 133333333 -#define MV_BOARD_TCLK_150MHZ 150000000 -#define MV_BOARD_TCLK_166MHZ 166666667 -#define MV_BOARD_TCLK_200MHZ 200000000 - -#define MV_BOARD_SYSCLK_100MHZ 100000000 -#define MV_BOARD_SYSCLK_125MHZ 125000000 -#define MV_BOARD_SYSCLK_133MHZ 133333333 -#define MV_BOARD_SYSCLK_150MHZ 150000000 -#define MV_BOARD_SYSCLK_166MHZ 166666667 -#define MV_BOARD_SYSCLK_200MHZ 200000000 -#define MV_BOARD_SYSCLK_233MHZ 233333333 -#define MV_BOARD_SYSCLK_250MHZ 250000000 -#define MV_BOARD_SYSCLK_267MHZ 266666667 -#define MV_BOARD_SYSCLK_300MHZ 300000000 -#define MV_BOARD_SYSCLK_333MHZ 333333334 -#define MV_BOARD_SYSCLK_400MHZ 400000000 - -#define MV_BOARD_REFCLK_25MHZ 25000000 - -/* Board specific */ -/* =============================== */ - -/* boards ID numbers */ - -#define BOARD_ID_BASE 0x0 - -/* New board ID numbers */ -#define DB_88F6281A_BP_ID (BOARD_ID_BASE) -#define DB_88F6281_BP_MLL_ID 1680 -#define RD_88F6281A_ID (BOARD_ID_BASE+0x1) -#define RD_88F6281_MLL_ID 1682 -#define DB_88F6192A_BP_ID (BOARD_ID_BASE+0x2) -#define RD_88F6192A_ID (BOARD_ID_BASE+0x3) -#define RD_88F6192_MLL_ID 1681 -#define DB_88F6180A_BP_ID (BOARD_ID_BASE+0x4) -#define DB_88F6190A_BP_ID (BOARD_ID_BASE+0x5) -#define RD_88F6190A_ID (BOARD_ID_BASE+0x6) -#define RD_88F6281A_PCAC_ID (BOARD_ID_BASE+0x7) -#define DB_CUSTOMER_ID (BOARD_ID_BASE+0x8) -#define SHEEVA_PLUG_ID (BOARD_ID_BASE+0x9) -#define MV_MAX_BOARD_ID (SHEEVA_PLUG_ID + 1) - -/* DB-88F6281A-BP */ -#if defined(MV_NAND) - #define DB_88F6281A_MPP0_7 0x21111111 -#else - #define DB_88F6281A_MPP0_7 0x21112220 -#endif -#define DB_88F6281A_MPP8_15 0x11113311 -#define DB_88F6281A_MPP16_23 0x00551111 -#define DB_88F6281A_MPP24_31 0x00000000 -#define DB_88F6281A_MPP32_39 0x00000000 -#define DB_88F6281A_MPP40_47 0x00000000 -#define DB_88F6281A_MPP48_55 0x00000000 -#define DB_88F6281A_OE_LOW 0x0 -#if defined(MV_TDM_5CHANNELS) - #define DB_88F6281A_OE_HIGH (BIT6) -#else -#define DB_88F6281A_OE_HIGH 0x0 -#endif -#define DB_88F6281A_OE_VAL_LOW 0x0 -#define DB_88F6281A_OE_VAL_HIGH 0x0 - -/* RD-88F6281A */ -#if defined(MV_NAND) - #define RD_88F6281A_MPP0_7 0x21111111 -#else - #define RD_88F6281A_MPP0_7 0x21112220 -#endif -#define RD_88F6281A_MPP8_15 0x11113311 -#define RD_88F6281A_MPP16_23 0x33331111 -#define RD_88F6281A_MPP24_31 0x33003333 -#define RD_88F6281A_MPP32_39 0x20440533 -#define RD_88F6281A_MPP40_47 0x22202222 -#define RD_88F6281A_MPP48_55 0x00000002 -#define RD_88F6281A_OE_LOW (BIT28 | BIT29) -#define RD_88F6281A_OE_HIGH (BIT3 | BIT6 | BIT17) -#define RD_88F6281A_OE_VAL_LOW 0x0 -#define RD_88F6281A_OE_VAL_HIGH 0x0 - -/* DB-88F6192A-BP */ -#if defined(MV_NAND) - #define DB_88F6192A_MPP0_7 0x21111111 -#else - #define DB_88F6192A_MPP0_7 0x21112220 -#endif -#define DB_88F6192A_MPP8_15 0x11113311 -#define DB_88F6192A_MPP16_23 0x00501111 -#define DB_88F6192A_MPP24_31 0x00000000 -#define DB_88F6192A_MPP32_35 0x00000000 -#define DB_88F6192A_OE_LOW (BIT22 | BIT23) -#define DB_88F6192A_OE_HIGH 0x0 -#define DB_88F6192A_OE_VAL_LOW 0x0 -#define DB_88F6192A_OE_VAL_HIGH 0x0 - -/* RD-88F6192A */ -#define RD_88F6192A_MPP0_7 0x01222222 -#define RD_88F6192A_MPP8_15 0x00000011 -#define RD_88F6192A_MPP16_23 0x05550000 -#define RD_88F6192A_MPP24_31 0x0 -#define RD_88F6192A_MPP32_35 0x0 -#define RD_88F6192A_OE_LOW (BIT11 | BIT14 | BIT24 | BIT25 | BIT26 | BIT27 | BIT30 | BIT31) -#define RD_88F6192A_OE_HIGH (BIT0 | BIT2) -#define RD_88F6192A_OE_VAL_LOW 0x18400 -#define RD_88F6192A_OE_VAL_HIGH 0x8 - -/* DB-88F6180A-BP */ -#if defined(MV_NAND) - #define DB_88F6180A_MPP0_7 0x21111111 -#else - #define DB_88F6180A_MPP0_7 0x01112222 -#endif -#define DB_88F6180A_MPP8_15 0x11113311 -#define DB_88F6180A_MPP16_23 0x00001111 -#define DB_88F6180A_MPP24_31 0x0 -#define DB_88F6180A_MPP32_39 0x4444c000 -#define DB_88F6180A_MPP40_44 0x00044444 -#define DB_88F6180A_OE_LOW 0x0 -#define DB_88F6180A_OE_HIGH 0x0 -#define DB_88F6180A_OE_VAL_LOW 0x0 -#define DB_88F6180A_OE_VAL_HIGH 0x0 - -/* RD-88F6281A_PCAC */ -#define RD_88F6281A_PCAC_MPP0_7 0x21111111 -#define RD_88F6281A_PCAC_MPP8_15 0x00003311 -#define RD_88F6281A_PCAC_MPP16_23 0x00001100 -#define RD_88F6281A_PCAC_MPP24_31 0x00000000 -#define RD_88F6281A_PCAC_MPP32_39 0x00000000 -#define RD_88F6281A_PCAC_MPP40_47 0x00000000 -#define RD_88F6281A_PCAC_MPP48_55 0x00000000 -#define RD_88F6281A_PCAC_OE_LOW 0x0 -#define RD_88F6281A_PCAC_OE_HIGH 0x0 -#define RD_88F6281A_PCAC_OE_VAL_LOW 0x0 -#define RD_88F6281A_PCAC_OE_VAL_HIGH 0x0 - -/* SHEEVA PLUG */ -#define RD_SHEEVA_PLUG_MPP0_7 0x01111111 -#define RD_SHEEVA_PLUG_MPP8_15 0x11113322 -#define RD_SHEEVA_PLUG_MPP16_23 0x00001111 -#define RD_SHEEVA_PLUG_MPP24_31 0x00100000 -#define RD_SHEEVA_PLUG_MPP32_39 0x00000000 -#define RD_SHEEVA_PLUG_MPP40_47 0x00000000 -#define RD_SHEEVA_PLUG_MPP48_55 0x00000000 -#define RD_SHEEVA_PLUG_OE_LOW 0x0 -#define RD_SHEEVA_PLUG_OE_HIGH 0x0 -#define RD_SHEEVA_PLUG_OE_VAL_LOW (BIT29) -#define RD_SHEEVA_PLUG_OE_VAL_HIGH ((~(BIT17 | BIT16 | BIT15)) | BIT14) - -/* DB-CUSTOMER */ -#define DB_CUSTOMER_MPP0_7 0x21111111 -#define DB_CUSTOMER_MPP8_15 0x00003311 -#define DB_CUSTOMER_MPP16_23 0x00001100 -#define DB_CUSTOMER_MPP24_31 0x00000000 -#define DB_CUSTOMER_MPP32_39 0x00000000 -#define DB_CUSTOMER_MPP40_47 0x00000000 -#define DB_CUSTOMER_MPP48_55 0x00000000 -#define DB_CUSTOMER_OE_LOW 0x0 -#define DB_CUSTOMER_OE_HIGH (~((BIT6) | (BIT7) | (BIT8) | (BIT9))) -#define DB_CUSTOMER_OE_VAL_LOW 0x0 -#define DB_CUSTOMER_OE_VAL_HIGH 0x0 - -#endif /* __INCmvBoardEnvSpech */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/cpu/mvCpu.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/cpu/mvCpu.c deleted file mode 100644 index fed0fa114e..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/cpu/mvCpu.c +++ /dev/null @@ -1,320 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#include "cpu/mvCpu.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/mvCtrlEnvRegs.h" -#include "ctrlEnv/sys/mvCpuIfRegs.h" - -/* defines */ -#ifdef MV_DEBUG - #define DB(x) x -#else - #define DB(x) -#endif - -/* locals */ - -/******************************************************************************* -* mvCpuPclkGet - Get the CPU pClk (pipe clock) -* -* DESCRIPTION: -* This routine extract the CPU core clock. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit clock cycles in MHertz. -* -*******************************************************************************/ -/* 6180 have different clk reset sampling */ - -static MV_U32 mvCpu6180PclkGet(MV_VOID) -{ - MV_U32 tmpPClkRate=0; - MV_CPU_ARM_CLK cpu6180_ddr_l2_CLK[] = MV_CPU6180_DDR_L2_CLCK_TBL; - - tmpPClkRate = MV_REG_READ(MPP_SAMPLE_AT_RESET); - tmpPClkRate = tmpPClkRate & MSAR_CPUCLCK_MASK_6180; - tmpPClkRate = tmpPClkRate >> MSAR_CPUCLCK_OFFS_6180; - - tmpPClkRate = cpu6180_ddr_l2_CLK[tmpPClkRate].cpuClk; - - return tmpPClkRate; -} - - -MV_U32 mvCpuPclkGet(MV_VOID) -{ -#if defined(PCLCK_AUTO_DETECT) - MV_U32 tmpPClkRate=0; - MV_U32 cpuCLK[] = MV_CPU_CLCK_TBL; - - if(mvCtrlModelGet() == MV_6180_DEV_ID) - return mvCpu6180PclkGet(); - - tmpPClkRate = MV_REG_READ(MPP_SAMPLE_AT_RESET); - tmpPClkRate = MSAR_CPUCLCK_EXTRACT(tmpPClkRate); - tmpPClkRate = cpuCLK[tmpPClkRate]; - - return tmpPClkRate; -#else - return MV_DEFAULT_PCLK -#endif -} - -/******************************************************************************* -* mvCpuL2ClkGet - Get the CPU L2 (CPU bus clock) -* -* DESCRIPTION: -* This routine extract the CPU L2 clock. -* -* RETURN: -* 32bit clock cycles in Hertz. -* -*******************************************************************************/ -static MV_U32 mvCpu6180L2ClkGet(MV_VOID) -{ - MV_U32 L2ClkRate=0; - MV_CPU_ARM_CLK _cpu6180_ddr_l2_CLK[] = MV_CPU6180_DDR_L2_CLCK_TBL; - - L2ClkRate = MV_REG_READ(MPP_SAMPLE_AT_RESET); - L2ClkRate = L2ClkRate & MSAR_CPUCLCK_MASK_6180; - L2ClkRate = L2ClkRate >> MSAR_CPUCLCK_OFFS_6180; - - L2ClkRate = _cpu6180_ddr_l2_CLK[L2ClkRate].l2Clk; - - return L2ClkRate; - -} - -MV_U32 mvCpuL2ClkGet(MV_VOID) -{ -#ifdef L2CLK_AUTO_DETECT - MV_U32 L2ClkRate, tmp, pClkRate, indexL2Rtio; - MV_U32 L2Rtio[][2] = MV_L2_CLCK_RTIO_TBL; - - if(mvCtrlModelGet() == MV_6180_DEV_ID) - return mvCpu6180L2ClkGet(); - - pClkRate = mvCpuPclkGet(); - - tmp = MV_REG_READ(MPP_SAMPLE_AT_RESET); - indexL2Rtio = MSAR_L2CLCK_EXTRACT(tmp); - - L2ClkRate = ((pClkRate * L2Rtio[indexL2Rtio][1]) / L2Rtio[indexL2Rtio][0]); - - return L2ClkRate; -#else - return MV_BOARD_DEFAULT_L2CLK; -#endif -} - - -/******************************************************************************* -* mvCpuNameGet - Get CPU name -* -* DESCRIPTION: -* This function returns a string describing the CPU model and revision. -* -* INPUT: -* None. -* -* OUTPUT: -* pNameBuff - Buffer to contain board name string. Minimum size 32 chars. -* -* RETURN: -* None. -*******************************************************************************/ -MV_VOID mvCpuNameGet(char *pNameBuff) -{ - MV_U32 cpuModel; - - cpuModel = mvOsCpuPartGet(); - - /* The CPU module is indicated in the Processor Version Register (PVR) */ - switch(cpuModel) - { - case CPU_PART_MRVL131: - mvOsSPrintf(pNameBuff, "%s (Rev %d)", "Marvell Feroceon",mvOsCpuRevGet()); - break; - case CPU_PART_ARM926: - mvOsSPrintf(pNameBuff, "%s (Rev %d)", "ARM926",mvOsCpuRevGet()); - break; - case CPU_PART_ARM946: - mvOsSPrintf(pNameBuff, "%s (Rev %d)", "ARM946",mvOsCpuRevGet()); - break; - default: - mvOsSPrintf(pNameBuff,"??? (0x%04x) (Rev %d)",cpuModel,mvOsCpuRevGet()); - break; - } /* switch */ - - return; -} - - -#define MV_PROC_STR_SIZE 50 - -static void mvCpuIfGetL2EccMode(MV_8 *buf) -{ - MV_U32 regVal = MV_REG_READ(CPU_L2_CONFIG_REG); - if (regVal & BIT2) - mvOsSPrintf(buf, "L2 ECC Enabled"); - else - mvOsSPrintf(buf, "L2 ECC Disabled"); -} - -static void mvCpuIfGetL2Mode(MV_8 *buf) -{ - MV_U32 regVal = 0; - __asm volatile ("mrc p15, 1, %0, c15, c1, 0" : "=r" (regVal)); /* Read Marvell extra features register */ - if (regVal & BIT22) - mvOsSPrintf(buf, "L2 Enabled"); - else - mvOsSPrintf(buf, "L2 Disabled"); -} - -static void mvCpuIfGetL2PrefetchMode(MV_8 *buf) -{ - MV_U32 regVal = 0; - __asm volatile ("mrc p15, 1, %0, c15, c1, 0" : "=r" (regVal)); /* Read Marvell extra features register */ - if (regVal & BIT24) - mvOsSPrintf(buf, "L2 Prefetch Disabled"); - else - mvOsSPrintf(buf, "L2 Prefetch Enabled"); -} - -static void mvCpuIfGetWriteAllocMode(MV_8 *buf) -{ - MV_U32 regVal = 0; - __asm volatile ("mrc p15, 1, %0, c15, c1, 0" : "=r" (regVal)); /* Read Marvell extra features register */ - if (regVal & BIT28) - mvOsSPrintf(buf, "Write Allocate Enabled"); - else - mvOsSPrintf(buf, "Write Allocate Disabled"); -} - -static void mvCpuIfGetCpuStreamMode(MV_8 *buf) -{ - MV_U32 regVal = 0; - __asm volatile ("mrc p15, 1, %0, c15, c1, 0" : "=r" (regVal)); /* Read Marvell extra features register */ - if (regVal & BIT29) - mvOsSPrintf(buf, "CPU Streaming Enabled"); - else - mvOsSPrintf(buf, "CPU Streaming Disabled"); -} - -static void mvCpuIfPrintCpuRegs(void) -{ - MV_U32 regVal = 0; - - __asm volatile ("mrc p15, 1, %0, c15, c1, 0" : "=r" (regVal)); /* Read Marvell extra features register */ - mvOsPrintf("Extra Feature Reg = 0x%x\n",regVal); - - __asm volatile ("mrc p15, 0, %0, c1, c0, 0" : "=r" (regVal)); /* Read Control register */ - mvOsPrintf("Control Reg = 0x%x\n",regVal); - - __asm volatile ("mrc p15, 0, %0, c0, c0, 0" : "=r" (regVal)); /* Read ID Code register */ - mvOsPrintf("ID Code Reg = 0x%x\n",regVal); - - __asm volatile ("mrc p15, 0, %0, c0, c0, 1" : "=r" (regVal)); /* Read Cache Type register */ - mvOsPrintf("Cache Type Reg = 0x%x\n",regVal); - -} - -MV_U32 mvCpuIfPrintSystemConfig(MV_8 *buffer, MV_U32 index) -{ - MV_U32 count = 0; - - MV_8 L2_ECC_str[MV_PROC_STR_SIZE]; - MV_8 L2_En_str[MV_PROC_STR_SIZE]; - MV_8 L2_Prefetch_str[MV_PROC_STR_SIZE]; - MV_8 Write_Alloc_str[MV_PROC_STR_SIZE]; - MV_8 Cpu_Stream_str[MV_PROC_STR_SIZE]; - - mvCpuIfGetL2Mode(L2_En_str); - mvCpuIfGetL2EccMode(L2_ECC_str); - mvCpuIfGetL2PrefetchMode(L2_Prefetch_str); - mvCpuIfGetWriteAllocMode(Write_Alloc_str); - mvCpuIfGetCpuStreamMode(Cpu_Stream_str); - mvCpuIfPrintCpuRegs(); - - count += mvOsSPrintf(buffer + count + index, "%s\n", L2_En_str); - count += mvOsSPrintf(buffer + count + index, "%s\n", L2_ECC_str); - count += mvOsSPrintf(buffer + count + index, "%s\n", L2_Prefetch_str); - count += mvOsSPrintf(buffer + count + index, "%s\n", Write_Alloc_str); - count += mvOsSPrintf(buffer + count + index, "%s\n", Cpu_Stream_str); - return count; -} - -MV_U32 whoAmI(MV_VOID) -{ - return 0; -} - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/cpu/mvCpu.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/cpu/mvCpu.h deleted file mode 100644 index 7f58b03f1f..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/cpu/mvCpu.h +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __INCmvCpuh -#define __INCmvCpuh - -#include "mvCommon.h" -#include "mvOs.h" -#include "ctrlEnv/mvCtrlEnvSpec.h" - -/* defines */ -#define CPU_PART_MRVL131 0x131 -#define CPU_PART_ARM926 0x926 -#define CPU_PART_ARM946 0x946 -#define MV_CPU_ARM_CLK_ELM_SIZE 12 -#define MV_CPU_ARM_CLK_RATIO_OFF 8 -#define MV_CPU_ARM_CLK_DDR_OFF 4 - -#ifndef MV_ASMLANGUAGE -typedef struct _mvCpuArmClk -{ - MV_U32 cpuClk; /* CPU clock in MHz */ - MV_U32 ddrClk; /* DDR clock in MHz */ - MV_U32 l2Clk; /* CPU DDR clock ratio */ - -}MV_CPU_ARM_CLK; - -MV_U32 mvCpuPclkGet(MV_VOID); -MV_VOID mvCpuNameGet(char *pNameBuff); -MV_U32 mvCpuL2ClkGet(MV_VOID); -MV_U32 mvCpuIfPrintSystemConfig(MV_8 *buffer, MV_U32 index); -MV_U32 whoAmI(MV_VOID); - -#endif /* MV_ASMLANGUAGE */ - - -#endif /* __INCmvCpuh */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvAddrDec.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvAddrDec.c deleted file mode 100644 index 2d148e0fc9..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvAddrDec.c +++ /dev/null @@ -1,296 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -/******************************************************************************* -* mvCtrlEnvAddrDec.h - Marvell controller address decode library -* -* DESCRIPTION: -* -* DEPENDENCIES: -* None. -* -*******************************************************************************/ - -/* includes */ -#include "ctrlEnv/mvCtrlEnvAddrDec.h" -#include "ctrlEnv/sys/mvAhbToMbusRegs.h" -#include "ddr2/mvDramIfRegs.h" -#include "pex/mvPexRegs.h" - -#define MV_DEBUG - -/* defines */ -#ifdef MV_DEBUG - #define DB(x) x -#else - #define DB(x) -#endif - -/* Default Attributes array */ -MV_TARGET_ATTRIB mvTargetDefaultsArray[] = TARGETS_DEF_ARRAY; -extern MV_TARGET *sampleAtResetTargetArray; -/* Dram\AHBToMbus\PEX share regsiter */ - -#define CTRL_DEC_BASE_OFFS 16 -#define CTRL_DEC_BASE_MASK (0xffff << CTRL_DEC_BASE_OFFS) -#define CTRL_DEC_BASE_ALIGNMENT 0x10000 - -#define CTRL_DEC_SIZE_OFFS 16 -#define CTRL_DEC_SIZE_MASK (0xffff << CTRL_DEC_SIZE_OFFS) -#define CTRL_DEC_SIZE_ALIGNMENT 0x10000 - -#define CTRL_DEC_WIN_EN BIT0 - - - -/******************************************************************************* -* mvCtrlAddrDecToReg - Get address decode register format values -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -* -*******************************************************************************/ -MV_STATUS mvCtrlAddrDecToReg(MV_ADDR_WIN *pAddrDecWin, MV_DEC_REGS *pAddrDecRegs) -{ - - MV_U32 baseToReg=0 , sizeToReg=0; - - /* BaseLow[31:16] => base register [31:16] */ - baseToReg = pAddrDecWin->baseLow & CTRL_DEC_BASE_MASK; - - /* Write to address decode Base Address Register */ - pAddrDecRegs->baseReg &= ~CTRL_DEC_BASE_MASK; - pAddrDecRegs->baseReg |= baseToReg; - - /* Get size register value according to window size */ - sizeToReg = ctrlSizeToReg(pAddrDecWin->size, CTRL_DEC_SIZE_ALIGNMENT); - - /* Size parameter validity check. */ - if (-1 == sizeToReg) - { - return MV_BAD_PARAM; - } - - /* set size */ - pAddrDecRegs->sizeReg &= ~CTRL_DEC_SIZE_MASK; - pAddrDecRegs->sizeReg |= (sizeToReg << CTRL_DEC_SIZE_OFFS); - - - return MV_OK; - -} - -/******************************************************************************* -* mvCtrlRegToAddrDec - Extract address decode struct from registers. -* -* DESCRIPTION: -* This function extract address decode struct from address decode -* registers given as parameters. -* -* INPUT: -* pAddrDecRegs - Address decode register struct. -* -* OUTPUT: -* pAddrDecWin - Target window data structure. -* -* RETURN: -* MV_BAD_PARAM if address decode registers data is invalid. -* -*******************************************************************************/ -MV_STATUS mvCtrlRegToAddrDec(MV_DEC_REGS *pAddrDecRegs, MV_ADDR_WIN *pAddrDecWin) -{ - MV_U32 sizeRegVal; - - sizeRegVal = (pAddrDecRegs->sizeReg & CTRL_DEC_SIZE_MASK) >> - CTRL_DEC_SIZE_OFFS; - - pAddrDecWin->size = ctrlRegToSize(sizeRegVal, CTRL_DEC_SIZE_ALIGNMENT); - - - /* Extract base address */ - /* Base register [31:16] ==> baseLow[31:16] */ - pAddrDecWin->baseLow = pAddrDecRegs->baseReg & CTRL_DEC_BASE_MASK; - - pAddrDecWin->baseHigh = 0; - - return MV_OK; - -} - -/******************************************************************************* -* mvCtrlAttribGet - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -* -*******************************************************************************/ - -MV_STATUS mvCtrlAttribGet(MV_TARGET target, - MV_TARGET_ATTRIB *targetAttrib) -{ - - targetAttrib->attrib = mvTargetDefaultsArray[MV_CHANGE_BOOT_CS(target)].attrib; - targetAttrib->targetId = mvTargetDefaultsArray[MV_CHANGE_BOOT_CS(target)].targetId; - - return MV_OK; - -} - -/******************************************************************************* -* mvCtrlGetAttrib - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -* -*******************************************************************************/ -MV_TARGET mvCtrlTargetGet(MV_TARGET_ATTRIB *targetAttrib) -{ - MV_TARGET target; - MV_TARGET x; - for (target = SDRAM_CS0; target < MAX_TARGETS ; target ++) - { - x = MV_CHANGE_BOOT_CS(target); - if ((mvTargetDefaultsArray[x].attrib == targetAttrib->attrib) && - (mvTargetDefaultsArray[MV_CHANGE_BOOT_CS(target)].targetId == targetAttrib->targetId)) - { - /* found it */ - break; - } - } - - return target; -} - -MV_STATUS mvCtrlAddrDecToParams(MV_DEC_WIN *pAddrDecWin, - MV_DEC_WIN_PARAMS *pWinParam) -{ - MV_U32 baseToReg=0, sizeToReg=0; - - /* BaseLow[31:16] => base register [31:16] */ - baseToReg = pAddrDecWin->addrWin.baseLow & CTRL_DEC_BASE_MASK; - - /* Write to address decode Base Address Register */ - pWinParam->baseAddr &= ~CTRL_DEC_BASE_MASK; - pWinParam->baseAddr |= baseToReg; - - /* Get size register value according to window size */ - sizeToReg = ctrlSizeToReg(pAddrDecWin->addrWin.size, CTRL_DEC_SIZE_ALIGNMENT); - - /* Size parameter validity check. */ - if (-1 == sizeToReg) - { - mvOsPrintf("mvCtrlAddrDecToParams: ERR. ctrlSizeToReg failed.\n"); - return MV_BAD_PARAM; - } - pWinParam->size = sizeToReg; - - pWinParam->attrib = mvTargetDefaultsArray[MV_CHANGE_BOOT_CS(pAddrDecWin->target)].attrib; - pWinParam->targetId = mvTargetDefaultsArray[MV_CHANGE_BOOT_CS(pAddrDecWin->target)].targetId; - - return MV_OK; -} - -MV_STATUS mvCtrlParamsToAddrDec(MV_DEC_WIN_PARAMS *pWinParam, - MV_DEC_WIN *pAddrDecWin) -{ - MV_TARGET_ATTRIB targetAttrib; - - pAddrDecWin->addrWin.baseLow = pWinParam->baseAddr; - - /* Upper 32bit address base is supported under PCI High Address remap */ - pAddrDecWin->addrWin.baseHigh = 0; - - /* Prepare sizeReg to ctrlRegToSize function */ - pAddrDecWin->addrWin.size = ctrlRegToSize(pWinParam->size, CTRL_DEC_SIZE_ALIGNMENT); - - if (-1 == pAddrDecWin->addrWin.size) - { - DB(mvOsPrintf("mvCtrlParamsToAddrDec: ERR. ctrlRegToSize failed.\n")); - return MV_BAD_PARAM; - } - targetAttrib.targetId = pWinParam->targetId; - targetAttrib.attrib = pWinParam->attrib; - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - return MV_OK; -} - - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvAddrDec.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvAddrDec.h deleted file mode 100644 index 30efe98ce9..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvAddrDec.h +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __INCmvCtrlEnvAddrDech -#define __INCmvCtrlEnvAddrDech - -/* includes */ -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/mvCtrlEnvRegs.h" - - -/* defines */ -/* DUnit attributes */ -#define ATMWCR_WIN_DUNIT_CS0_OFFS 0 -#define ATMWCR_WIN_DUNIT_CS0_MASK BIT0 -#define ATMWCR_WIN_DUNIT_CS0_REQ (0 << ATMWCR_WIN_DUNIT_CS0_OFFS) - -#define ATMWCR_WIN_DUNIT_CS1_OFFS 1 -#define ATMWCR_WIN_DUNIT_CS1_MASK BIT1 -#define ATMWCR_WIN_DUNIT_CS1_REQ (0 << ATMWCR_WIN_DUNIT_CS1_OFFS) - -#define ATMWCR_WIN_DUNIT_CS2_OFFS 2 -#define ATMWCR_WIN_DUNIT_CS2_MASK BIT2 -#define ATMWCR_WIN_DUNIT_CS2_REQ (0 << ATMWCR_WIN_DUNIT_CS2_OFFS) - -#define ATMWCR_WIN_DUNIT_CS3_OFFS 3 -#define ATMWCR_WIN_DUNIT_CS3_MASK BIT3 -#define ATMWCR_WIN_DUNIT_CS3_REQ (0 << ATMWCR_WIN_DUNIT_CS3_OFFS) - -/* RUnit (Device) attributes */ -#define ATMWCR_WIN_RUNIT_DEVCS0_OFFS 0 -#define ATMWCR_WIN_RUNIT_DEVCS0_MASK BIT0 -#define ATMWCR_WIN_RUNIT_DEVCS0_REQ (0 << ATMWCR_WIN_RUNIT_DEVCS0_OFFS) - -#define ATMWCR_WIN_RUNIT_DEVCS1_OFFS 1 -#define ATMWCR_WIN_RUNIT_DEVCS1_MASK BIT1 -#define ATMWCR_WIN_RUNIT_DEVCS1_REQ (0 << ATMWCR_WIN_RUNIT_DEVCS1_OFFS) - -#define ATMWCR_WIN_RUNIT_DEVCS2_OFFS 2 -#define ATMWCR_WIN_RUNIT_DEVCS2_MASK BIT2 -#define ATMWCR_WIN_RUNIT_DEVCS2_REQ (0 << ATMWCR_WIN_RUNIT_DEVCS2_OFFS) - -#define ATMWCR_WIN_RUNIT_BOOTCS_OFFS 4 -#define ATMWCR_WIN_RUNIT_BOOTCS_MASK BIT4 -#define ATMWCR_WIN_RUNIT_BOOTCS_REQ (0 << ATMWCR_WIN_RUNIT_BOOTCS_OFFS) - -/* LMaster (PCI) attributes */ -#define ATMWCR_WIN_LUNIT_BYTE_SWP_OFFS 0 -#define ATMWCR_WIN_LUNIT_BYTE_SWP_MASK BIT0 -#define ATMWCR_WIN_LUNIT_BYTE_SWP (0 << ATMWCR_WIN_LUNIT_BYTE_SWP_OFFS) -#define ATMWCR_WIN_LUNIT_BYTE_NO_SWP (1 << ATMWCR_WIN_LUNIT_BYTE_SWP_OFFS) - - -#define ATMWCR_WIN_LUNIT_WORD_SWP_OFFS 1 -#define ATMWCR_WIN_LUNIT_WORD_SWP_MASK BIT1 -#define ATMWCR_WIN_LUNIT_WORD_SWP (0 << ATMWCR_WIN_LUNIT_WORD_SWP_OFFS) -#define ATMWCR_WIN_LUNIT_WORD_NO_SWP (1 << ATMWCR_WIN_LUNIT_WORD_SWP_OFFS) - -#define ATMWCR_WIN_LUNIT_NO_SNOOP BIT2 - -#define ATMWCR_WIN_LUNIT_TYPE_OFFS 3 -#define ATMWCR_WIN_LUNIT_TYPE_MASK BIT3 -#define ATMWCR_WIN_LUNIT_TYPE_IO (0 << ATMWCR_WIN_LUNIT_TYPE_OFFS) -#define ATMWCR_WIN_LUNIT_TYPE_MEM (1 << ATMWCR_WIN_LUNIT_TYPE_OFFS) - -#define ATMWCR_WIN_LUNIT_FORCE64_OFFS 4 -#define ATMWCR_WIN_LUNIT_FORCE64_MASK BIT4 -#define ATMWCR_WIN_LUNIT_FORCE64 (0 << ATMWCR_WIN_LUNIT_FORCE64_OFFS) - -#define ATMWCR_WIN_LUNIT_ORDERING_OFFS 6 -#define ATMWCR_WIN_LUNIT_ORDERING_MASK BIT6 -#define ATMWCR_WIN_LUNIT_ORDERING (1 << ATMWCR_WIN_LUNIT_FORCE64_OFFS) - -/* PEX Attributes */ -#define ATMWCR_WIN_PEX_TYPE_OFFS 3 -#define ATMWCR_WIN_PEX_TYPE_MASK BIT3 -#define ATMWCR_WIN_PEX_TYPE_IO (0 << ATMWCR_WIN_PEX_TYPE_OFFS) -#define ATMWCR_WIN_PEX_TYPE_MEM (1 << ATMWCR_WIN_PEX_TYPE_OFFS) - -/* typedefs */ - -/* Unsupported attributes for address decode: */ -/* 2) PCI0/1_REQ64n control */ - -typedef struct _mvDecRegs -{ - MV_U32 baseReg; - MV_U32 baseRegHigh; - MV_U32 sizeReg; - -}MV_DEC_REGS; - -typedef struct _mvTargetAttrib -{ - MV_U8 attrib; /* chip select attributes */ - MV_TARGET_ID targetId; /* Target Id of this MV_TARGET */ - -}MV_TARGET_ATTRIB; - - -/* This structure describes address decode window */ -typedef struct _mvDecWin -{ - MV_TARGET target; /* Target for addr decode window */ - MV_ADDR_WIN addrWin; /* Address window of target */ - MV_BOOL enable; /* Window enable/disable */ -}MV_DEC_WIN; - -typedef struct _mvDecWinParams -{ - MV_TARGET_ID targetId; /* Target ID field */ - MV_U8 attrib; /* Attribute field */ - MV_U32 baseAddr; /* Base address in register format */ - MV_U32 size; /* Size in register format */ -}MV_DEC_WIN_PARAMS; - - -/* mvCtrlEnvAddrDec API list */ - -MV_STATUS mvCtrlAddrDecToReg(MV_ADDR_WIN *pAddrDecWin, - MV_DEC_REGS *pAddrDecRegs); - -MV_STATUS mvCtrlRegToAddrDec(MV_DEC_REGS *pAddrDecRegs, - MV_ADDR_WIN *pAddrDecWin); - -MV_STATUS mvCtrlAttribGet(MV_TARGET target, - MV_TARGET_ATTRIB *targetAttrib); - -MV_TARGET mvCtrlTargetGet(MV_TARGET_ATTRIB *targetAttrib); - - -MV_STATUS mvCtrlAddrDecToParams(MV_DEC_WIN *pAddrDecWin, - MV_DEC_WIN_PARAMS *pWinParam); - -MV_STATUS mvCtrlParamsToAddrDec(MV_DEC_WIN_PARAMS *pWinParam, - MV_DEC_WIN *pAddrDecWin); - - - - -#endif /* __INCmvCtrlEnvAddrDech */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvAsm.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvAsm.h deleted file mode 100644 index 6f6367a2fb..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvAsm.h +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __INCmvCtrlEnvAsmh -#define __INCmvCtrlEnvAsmh -#include "pex/mvPexRegs.h" - -#define CHIP_BOND_REG 0x10034 -#define PCKG_OPT_MASK_AS #3 -#define PXCCARI_REVID_MASK_AS #PXCCARI_REVID_MASK - -/* Read device ID into toReg bits 15:0 from 0xd0000000 */ -/* defines */ -#define MV_DV_CTRL_MODEL_GET_ASM(toReg, tmpReg) \ - MV_DV_REG_READ_ASM(toReg, tmpReg, CHIP_BOND_REG);\ - and toReg, toReg, PCKG_OPT_MASK_AS /* Mask for package ID */ - -/* Read device ID into toReg bits 15:0 from 0xf1000000*/ -#define MV_CTRL_MODEL_GET_ASM(toReg, tmpReg) \ - MV_REG_READ_ASM(toReg, tmpReg, CHIP_BOND_REG);\ - and toReg, toReg, PCKG_OPT_MASK_AS /* Mask for package ID */ - -/* Read Revision into toReg bits 7:0 0xd0000000*/ -#define MV_DV_CTRL_REV_GET_ASM(toReg, tmpReg) \ - /* Read device revision */ \ - MV_DV_REG_READ_ASM(toReg, tmpReg, PEX_CFG_DIRECT_ACCESS(0,PEX_CLASS_CODE_AND_REVISION_ID));\ - and toReg, toReg, PXCCARI_REVID_MASK_AS /* Mask for calss ID */ - -/* Read Revision into toReg bits 7:0 0xf1000000*/ -#define MV_CTRL_REV_GET_ASM(toReg, tmpReg) \ - /* Read device revision */ \ - MV_REG_READ_ASM(toReg, tmpReg, PEX_CFG_DIRECT_ACCESS(0,PEX_CLASS_CODE_AND_REVISION_ID));\ - and toReg, toReg, PXCCARI_REVID_MASK_AS /* Mask for calss ID */ - - -#endif /* __INCmvCtrlEnvAsmh */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvLib.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvLib.c deleted file mode 100644 index adf451d3e0..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvLib.c +++ /dev/null @@ -1,1825 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -/* includes */ -#include "mvCommon.h" -#include "mvCtrlEnvLib.h" -#include "ctrlEnv/sys/mvCpuIf.h" - -#if defined(MV_INCLUDE_PEX) -#include "pex/mvPex.h" -#include "ctrlEnv/sys/mvSysPex.h" -#endif - -#if defined(MV_INCLUDE_GIG_ETH) -#include "ctrlEnv/sys/mvSysGbe.h" -#endif - -#if defined(MV_INCLUDE_XOR) -#include "ctrlEnv/sys/mvSysXor.h" -#endif - -#if defined(MV_INCLUDE_SATA) -#include "ctrlEnv/sys/mvSysSata.h" -#endif - -#if defined(MV_INCLUDE_USB) -#include "ctrlEnv/sys/mvSysUsb.h" -#endif - -#if defined(MV_INCLUDE_AUDIO) -#include "ctrlEnv/sys/mvSysAudio.h" -#endif - -#if defined(MV_INCLUDE_CESA) -#include "ctrlEnv/sys/mvSysCesa.h" -#endif - -#if defined(MV_INCLUDE_TS) -#include "ctrlEnv/sys/mvSysTs.h" -#endif - -/* defines */ -#ifdef MV_DEBUG - #define DB(x) x -#else - #define DB(x) -#endif - -/******************************************************************************* -* mvCtrlEnvInit - Initialize Marvell controller environment. -* -* DESCRIPTION: -* This function get environment information and initialize controller -* internal/external environment. For example -* 1) MPP settings according to board MPP macros. -* NOTE: It is the user responsibility to shut down all DMA channels -* in device and disable controller sub units interrupts during -* boot process. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_STATUS mvCtrlEnvInit(MV_VOID) -{ - MV_U32 mppGroup; - MV_U32 devId; - MV_U32 boardId; - MV_U32 i; - MV_U32 maxMppGrp = 1; - MV_U32 mppVal = 0; - MV_U32 bootVal = 0; - MV_U32 mppGroupType = 0; - MV_U32 mppGroup1[][3] = MPP_GROUP_1_TYPE; - MV_U32 mppGroup2[][3] = MPP_GROUP_2_TYPE; - - devId = mvCtrlModelGet(); - boardId= mvBoardIdGet(); - - switch(devId){ - case MV_6281_DEV_ID: - maxMppGrp = MV_6281_MPP_MAX_GROUP; - break; - case MV_6192_DEV_ID: - maxMppGrp = MV_6192_MPP_MAX_GROUP; - break; - case MV_6190_DEV_ID: - maxMppGrp = MV_6190_MPP_MAX_GROUP; - break; - case MV_6180_DEV_ID: - maxMppGrp = MV_6180_MPP_MAX_GROUP; - break; - } - - /* MPP Init */ - /* We split mpp init to 3 phases: - * 1. We init mpp[19:0] from the board info. mpp[23:20] will be over write - * in phase 2. - * 2. We detect the mpp group type and according the mpp values [35:20]. - * 3. We detect the mpp group type and according the mpp values [49:36]. - */ - /* Mpp phase 1 mpp[19:0] */ - /* Read MPP group from board level and assign to MPP register */ - for (mppGroup = 0; mppGroup < 3; mppGroup++) - { - mppVal = mvBoardMppGet(mppGroup); - if (mppGroup == 0) - { - bootVal = MV_REG_READ(mvCtrlMppRegGet(mppGroup)); - if (mvCtrlIsBootFromSPI()) - { - mppVal &= ~0xffff; - bootVal &= 0xffff; - mppVal |= bootVal; - } - else if (mvCtrlIsBootFromSPIUseNAND()) - { - mppVal &= ~0xf0000000; - bootVal &= 0xf0000000; - mppVal |= bootVal; - } - else if (mvCtrlIsBootFromNAND()) - { - mppVal &= ~0xffffff; - bootVal &= 0xffffff; - mppVal |= bootVal; - } - } - - if (mppGroup == 2) - { - bootVal = MV_REG_READ(mvCtrlMppRegGet(mppGroup)); - if (mvCtrlIsBootFromNAND()) - { - mppVal &= ~0xff00; - bootVal &= 0xff00; - mppVal |= bootVal; - } - } - - MV_REG_WRITE(mvCtrlMppRegGet(mppGroup), mppVal); - } - - /* Identify MPPs group */ - mvBoardMppGroupIdUpdate(); - - /* Update MPPs mux relevent only on Marvell DB */ - if ((boardId == DB_88F6281A_BP_ID) || - (boardId == DB_88F6180A_BP_ID)) - mvBoardMppMuxSet(); - - mppGroupType = mvBoardMppGroupTypeGet(MV_BOARD_MPP_GROUP_1); - - /* Mpp phase 2 */ - /* Read MPP group from board level and assign to MPP register */ - if (devId != MV_6180_DEV_ID) - { - i = 0; - for (mppGroup = 2; mppGroup < 5; mppGroup++) - { - if ((mppGroupType == MV_BOARD_OTHER) || - (boardId == RD_88F6281A_ID) || - (boardId == RD_88F6192A_ID) || - (boardId == RD_88F6190A_ID) || - (boardId == RD_88F6281A_PCAC_ID) || - (boardId == SHEEVA_PLUG_ID)) - mppVal = mvBoardMppGet(mppGroup); - else - { - mppVal = mppGroup1[mppGroupType][i]; - i++; - } - - /* Group 2 is shared mpp[23:16] */ - if (mppGroup == 2) - { - bootVal = MV_REG_READ(mvCtrlMppRegGet(mppGroup)); - mppVal &= ~0xffff; - bootVal &= 0xffff; - mppVal |= bootVal; - } - - MV_REG_WRITE(mvCtrlMppRegGet(mppGroup), mppVal); - } - } - - if ((devId == MV_6192_DEV_ID) || (devId == MV_6190_DEV_ID)) - return MV_OK; - - /* Mpp phase 3 */ - mppGroupType = mvBoardMppGroupTypeGet(MV_BOARD_MPP_GROUP_2); - /* Read MPP group from board level and assign to MPP register */ - i = 0; - for (mppGroup = 4; mppGroup < 7; mppGroup++) - { - if ((mppGroupType == MV_BOARD_OTHER) || - (boardId == RD_88F6281A_ID) || - (boardId == RD_88F6281A_PCAC_ID) || - (boardId == SHEEVA_PLUG_ID)) - mppVal = mvBoardMppGet(mppGroup); - else - { - mppVal = mppGroup2[mppGroupType][i]; - i++; - } - - /* Group 4 is shared mpp[35:32] */ - if (mppGroup == 4) - { - bootVal = MV_REG_READ(mvCtrlMppRegGet(mppGroup)); - mppVal &= ~0xffff; - bootVal &= 0xffff; - mppVal |= bootVal; - } - - MV_REG_WRITE(mvCtrlMppRegGet(mppGroup), mppVal); - } - /* Update SSCG configuration register*/ - if(mvBoardIdGet() == DB_88F6281A_BP_ID || mvBoardIdGet() == DB_88F6192A_BP_ID || - mvBoardIdGet() == DB_88F6190A_BP_ID || mvBoardIdGet() == DB_88F6180A_BP_ID) - MV_REG_WRITE(0x100d8, 0x53); - - return MV_OK; -} - -/******************************************************************************* -* mvCtrlMppRegGet - return reg address of mpp group -* -* DESCRIPTION: -* -* INPUT: -* mppGroup - MPP group. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_U32 - Register address. -* -*******************************************************************************/ -MV_U32 mvCtrlMppRegGet(MV_U32 mppGroup) -{ - MV_U32 ret; - - switch(mppGroup){ - case (0): ret = MPP_CONTROL_REG0; - break; - case (1): ret = MPP_CONTROL_REG1; - break; - case (2): ret = MPP_CONTROL_REG2; - break; - case (3): ret = MPP_CONTROL_REG3; - break; - case (4): ret = MPP_CONTROL_REG4; - break; - case (5): ret = MPP_CONTROL_REG5; - break; - case (6): ret = MPP_CONTROL_REG6; - break; - default: ret = MPP_CONTROL_REG0; - break; - } - return ret; -} -#if defined(MV_INCLUDE_PEX) -/******************************************************************************* -* mvCtrlPexMaxIfGet - Get Marvell controller number of PEX interfaces. -* -* DESCRIPTION: -* This function returns Marvell controller number of PEX interfaces. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* Marvell controller number of PEX interfaces. If controller -* ID is undefined the function returns '0'. -* -*******************************************************************************/ -MV_U32 mvCtrlPexMaxIfGet(MV_VOID) -{ - - return MV_PEX_MAX_IF; -} -#endif - -#if defined(MV_INCLUDE_GIG_ETH) -/******************************************************************************* -* mvCtrlEthMaxPortGet - Get Marvell controller number of etherent ports. -* -* DESCRIPTION: -* This function returns Marvell controller number of etherent port. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* Marvell controller number of etherent port. -* -*******************************************************************************/ -MV_U32 mvCtrlEthMaxPortGet(MV_VOID) -{ - MV_U32 devId; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - return MV_6281_ETH_MAX_PORTS; - break; - case MV_6192_DEV_ID: - return MV_6192_ETH_MAX_PORTS; - break; - case MV_6190_DEV_ID: - return MV_6190_ETH_MAX_PORTS; - break; - case MV_6180_DEV_ID: - return MV_6180_ETH_MAX_PORTS; - break; - } - return 0; - -} -#endif - -#if defined(MV_INCLUDE_XOR) -/******************************************************************************* -* mvCtrlXorMaxChanGet - Get Marvell controller number of XOR channels. -* -* DESCRIPTION: -* This function returns Marvell controller number of XOR channels. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* Marvell controller number of XOR channels. -* -*******************************************************************************/ -MV_U32 mvCtrlXorMaxChanGet(MV_VOID) -{ - return MV_XOR_MAX_CHAN; -} -#endif - -#if defined(MV_INCLUDE_USB) -/******************************************************************************* -* mvCtrlUsbHostMaxGet - Get number of Marvell Usb controllers -* -* DESCRIPTION: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* returns number of Marvell USB controllers. -* -*******************************************************************************/ -MV_U32 mvCtrlUsbMaxGet(void) -{ - return MV_USB_MAX_PORTS; -} -#endif - - -#if defined(MV_INCLUDE_NAND) -/******************************************************************************* -* mvCtrlNandSupport - Return if this controller has integrated NAND flash support -* -* DESCRIPTION: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if NAND is supported and MV_FALSE otherwise -* -*******************************************************************************/ -MV_U32 mvCtrlNandSupport(MV_VOID) -{ - MV_U32 devId; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - return MV_6281_NAND; - break; - case MV_6192_DEV_ID: - return MV_6192_NAND; - break; - case MV_6190_DEV_ID: - return MV_6190_NAND; - break; - case MV_6180_DEV_ID: - return MV_6180_NAND; - break; - } - return 0; - -} -#endif - -#if defined(MV_INCLUDE_SDIO) -/******************************************************************************* -* mvCtrlSdioSupport - Return if this controller has integrated SDIO flash support -* -* DESCRIPTION: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if SDIO is supported and MV_FALSE otherwise -* -*******************************************************************************/ -MV_U32 mvCtrlSdioSupport(MV_VOID) -{ - MV_U32 devId; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - return MV_6281_SDIO; - break; - case MV_6192_DEV_ID: - return MV_6192_SDIO; - break; - case MV_6190_DEV_ID: - return MV_6190_SDIO; - break; - case MV_6180_DEV_ID: - return MV_6180_SDIO; - break; - } - return 0; - -} -#endif - -#if defined(MV_INCLUDE_TS) -/******************************************************************************* -* mvCtrlTsSupport - Return if this controller has integrated TS flash support -* -* DESCRIPTION: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if TS is supported and MV_FALSE otherwise -* -*******************************************************************************/ -MV_U32 mvCtrlTsSupport(MV_VOID) -{ - MV_U32 devId; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - return MV_6281_TS; - break; - case MV_6192_DEV_ID: - return MV_6192_TS; - break; - case MV_6190_DEV_ID: - return MV_6190_TS; - break; - case MV_6180_DEV_ID: - return MV_6180_TS; - break; - } - return 0; -} -#endif - -#if defined(MV_INCLUDE_AUDIO) -/******************************************************************************* -* mvCtrlAudioSupport - Return if this controller has integrated AUDIO flash support -* -* DESCRIPTION: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if AUDIO is supported and MV_FALSE otherwise -* -*******************************************************************************/ -MV_U32 mvCtrlAudioSupport(MV_VOID) -{ - MV_U32 devId; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - return MV_6281_AUDIO; - break; - case MV_6192_DEV_ID: - return MV_6192_AUDIO; - break; - case MV_6190_DEV_ID: - return MV_6190_AUDIO; - break; - case MV_6180_DEV_ID: - return MV_6180_AUDIO; - break; - } - return 0; - -} -#endif - -#if defined(MV_INCLUDE_TDM) -/******************************************************************************* -* mvCtrlTdmSupport - Return if this controller has integrated TDM flash support -* -* DESCRIPTION: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if TDM is supported and MV_FALSE otherwise -* -*******************************************************************************/ -MV_U32 mvCtrlTdmSupport(MV_VOID) -{ - MV_U32 devId; - - devId = mvCtrlModelGet(); - - switch(devId){ - case MV_6281_DEV_ID: - return MV_6281_TDM; - break; - case MV_6192_DEV_ID: - return MV_6192_TDM; - break; - case MV_6190_DEV_ID: - return MV_6190_TDM; - break; - case MV_6180_DEV_ID: - return MV_6180_TDM; - break; - } - return 0; - -} -#endif - -/******************************************************************************* -* mvCtrlModelGet - Get Marvell controller device model (Id) -* -* DESCRIPTION: -* This function returns 16bit describing the device model (ID) as defined -* in PCI Device and Vendor ID configuration register offset 0x0. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* 16bit desscribing Marvell controller ID -* -*******************************************************************************/ -MV_U16 mvCtrlModelGet(MV_VOID) -{ - MV_U32 devId; - - devId = MV_REG_READ(CHIP_BOND_REG); - devId &= PCKG_OPT_MASK; - - switch(devId){ - case 2: - return MV_6281_DEV_ID; - break; - case 1: - if (((MV_REG_READ(PEX_CFG_DIRECT_ACCESS(0,PEX_DEVICE_AND_VENDOR_ID))& 0xffff0000) >> 16) - == MV_6190_DEV_ID) - return MV_6190_DEV_ID; - else - return MV_6192_DEV_ID; - break; - case 0: - return MV_6180_DEV_ID; - break; - } - - return 0; -} -/******************************************************************************* -* mvCtrlRevGet - Get Marvell controller device revision number -* -* DESCRIPTION: -* This function returns 8bit describing the device revision as defined -* in PCI Express Class Code and Revision ID Register. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* 8bit desscribing Marvell controller revision number -* -*******************************************************************************/ -MV_U8 mvCtrlRevGet(MV_VOID) -{ - MV_U8 revNum; -#if defined(MV_INCLUDE_CLK_PWR_CNTRL) - /* Check pex power state */ - MV_U32 pexPower; - pexPower = mvCtrlPwrClckGet(PEX_UNIT_ID,0); - if (pexPower == MV_FALSE) - mvCtrlPwrClckSet(PEX_UNIT_ID, 0, MV_TRUE); -#endif - revNum = (MV_U8)MV_REG_READ(PEX_CFG_DIRECT_ACCESS(0,PCI_CLASS_CODE_AND_REVISION_ID)); -#if defined(MV_INCLUDE_CLK_PWR_CNTRL) - /* Return to power off state */ - if (pexPower == MV_FALSE) - mvCtrlPwrClckSet(PEX_UNIT_ID, 0, MV_FALSE); -#endif - return ((revNum & PCCRIR_REVID_MASK) >> PCCRIR_REVID_OFFS); -} - -/******************************************************************************* -* mvCtrlNameGet - Get Marvell controller name -* -* DESCRIPTION: -* This function returns a string describing the device model and revision. -* -* INPUT: -* None. -* -* OUTPUT: -* pNameBuff - Buffer to contain device name string. Minimum size 30 chars. -* -* RETURN: -* -* MV_ERROR if informantion can not be read. -*******************************************************************************/ -MV_STATUS mvCtrlNameGet(char *pNameBuff) -{ - mvOsSPrintf (pNameBuff, "%s%x Rev %d", SOC_NAME_PREFIX, - mvCtrlModelGet(), mvCtrlRevGet()); - - return MV_OK; -} - -/******************************************************************************* -* mvCtrlModelRevGet - Get Controller Model (Device ID) and Revision -* -* DESCRIPTION: -* This function returns 32bit value describing both Device ID and Revision -* as defined in PCI Express Device and Vendor ID Register and device revision -* as defined in PCI Express Class Code and Revision ID Register. - -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit describing both controller device ID and revision number -* -*******************************************************************************/ -MV_U32 mvCtrlModelRevGet(MV_VOID) -{ - return ((mvCtrlModelGet() << 16) | mvCtrlRevGet()); -} - -/******************************************************************************* -* mvCtrlModelRevNameGet - Get Marvell controller name -* -* DESCRIPTION: -* This function returns a string describing the device model and revision. -* -* INPUT: -* None. -* -* OUTPUT: -* pNameBuff - Buffer to contain device name string. Minimum size 30 chars. -* -* RETURN: -* -* MV_ERROR if informantion can not be read. -*******************************************************************************/ - -MV_STATUS mvCtrlModelRevNameGet(char *pNameBuff) -{ - - switch (mvCtrlModelRevGet()) - { - case MV_6281_A0_ID: - mvOsSPrintf (pNameBuff, "%s",MV_6281_A0_NAME); - break; - case MV_6192_A0_ID: - mvOsSPrintf (pNameBuff, "%s",MV_6192_A0_NAME); - break; - case MV_6180_A0_ID: - mvOsSPrintf (pNameBuff, "%s",MV_6180_A0_NAME); - break; - case MV_6190_A0_ID: - mvOsSPrintf (pNameBuff, "%s",MV_6190_A0_NAME); - break; - case MV_6281_A1_ID: - mvOsSPrintf (pNameBuff, "%s",MV_6281_A1_NAME); - break; - case MV_6192_A1_ID: - mvOsSPrintf (pNameBuff, "%s",MV_6192_A1_NAME); - break; - case MV_6180_A1_ID: - mvOsSPrintf (pNameBuff, "%s",MV_6180_A1_NAME); - break; - case MV_6190_A1_ID: - mvOsSPrintf (pNameBuff, "%s",MV_6190_A1_NAME); - break; - default: - mvCtrlNameGet(pNameBuff); - break; - } - - return MV_OK; -} - - -/******************************************************************************* -* ctrlWinOverlapTest - Test address windows for overlaping. -* -* DESCRIPTION: -* This function checks the given two address windows for overlaping. -* -* INPUT: -* pAddrWin1 - Address window 1. -* pAddrWin2 - Address window 2. -* -* OUTPUT: -* None. -* -* RETURN: -* -* MV_TRUE if address window overlaps, MV_FALSE otherwise. -*******************************************************************************/ -MV_STATUS ctrlWinOverlapTest(MV_ADDR_WIN *pAddrWin1, MV_ADDR_WIN *pAddrWin2) -{ - MV_U32 winBase1, winBase2; - MV_U32 winTop1, winTop2; - - /* check if we have overflow than 4G*/ - if (((0xffffffff - pAddrWin1->baseLow) < pAddrWin1->size-1)|| - ((0xffffffff - pAddrWin2->baseLow) < pAddrWin2->size-1)) - { - return MV_TRUE; - } - - winBase1 = pAddrWin1->baseLow; - winBase2 = pAddrWin2->baseLow; - winTop1 = winBase1 + pAddrWin1->size-1; - winTop2 = winBase2 + pAddrWin2->size-1; - - - if (((winBase1 <= winTop2 ) && ( winTop2 <= winTop1)) || - ((winBase1 <= winBase2) && (winBase2 <= winTop1))) - { - return MV_TRUE; - } - else - { - return MV_FALSE; - } -} - -/******************************************************************************* -* ctrlWinWithinWinTest - Test address windows for overlaping. -* -* DESCRIPTION: -* This function checks the given win1 boundries is within -* win2 boundries. -* -* INPUT: -* pAddrWin1 - Address window 1. -* pAddrWin2 - Address window 2. -* -* OUTPUT: -* None. -* -* RETURN: -* -* MV_TRUE if found win1 inside win2, MV_FALSE otherwise. -*******************************************************************************/ -MV_STATUS ctrlWinWithinWinTest(MV_ADDR_WIN *pAddrWin1, MV_ADDR_WIN *pAddrWin2) -{ - MV_U32 winBase1, winBase2; - MV_U32 winTop1, winTop2; - - winBase1 = pAddrWin1->baseLow; - winBase2 = pAddrWin2->baseLow; - winTop1 = winBase1 + pAddrWin1->size -1; - winTop2 = winBase2 + pAddrWin2->size -1; - - if (((winBase1 >= winBase2 ) && ( winBase1 <= winTop2)) || - ((winTop1 >= winBase2) && (winTop1 <= winTop2))) - { - return MV_TRUE; - } - else - { - return MV_FALSE; - } -} - -static const char* cntrlName[] = TARGETS_NAME_ARRAY; - -/******************************************************************************* -* mvCtrlTargetNameGet - Get Marvell controller target name -* -* DESCRIPTION: -* This function convert the trget enumeration to string. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* Target name (const MV_8 *) -*******************************************************************************/ -const MV_8* mvCtrlTargetNameGet( MV_TARGET target ) -{ - - if (target >= MAX_TARGETS) - { - return "target unknown"; - } - - return cntrlName[target]; -} - -/******************************************************************************* -* mvCtrlAddrDecShow - Print the Controller units address decode map. -* -* DESCRIPTION: -* This function the Controller units address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvCtrlAddrDecShow(MV_VOID) -{ - mvCpuIfAddDecShow(); - mvAhbToMbusAddDecShow(); -#if defined(MV_INCLUDE_PEX) - mvPexAddrDecShow(); -#endif -#if defined(MV_INCLUDE_USB) - mvUsbAddrDecShow(); -#endif -#if defined(MV_INCLUDE_GIG_ETH) - mvEthAddrDecShow(); -#endif -#if defined(MV_INCLUDE_XOR) - mvXorAddrDecShow(); -#endif -#if defined(MV_INCLUDE_SATA) - mvSataAddrDecShow(); -#endif -#if defined(MV_INCLUDE_AUDIO) - mvAudioAddrDecShow(); -#endif -#if defined(MV_INCLUDE_TS) - mvTsuAddrDecShow(); -#endif -} - -/******************************************************************************* -* ctrlSizeToReg - Extract size value for register assignment. -* -* DESCRIPTION: -* Address decode size parameter must be programed from LSB to MSB as -* sequence of 1's followed by sequence of 0's. The number of 1's -* specifies the size of the window in 64 KB granularity (e.g. a -* value of 0x00ff specifies 256x64k = 16 MB). -* This function extract the size value from the size parameter according -* to given aligment paramter. For example for size 0x1000000 (16MB) and -* aligment 0x10000 (64KB) the function will return 0x00FF. -* -* INPUT: -* size - Size. -* alignment - Size alignment. Note that alignment must be power of 2! -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit describing size register value correspond to size parameter. -* If value is '-1' size parameter or aligment are invalid. -*******************************************************************************/ -MV_U32 ctrlSizeToReg(MV_U32 size, MV_U32 alignment) -{ - MV_U32 retVal; - - /* Check size parameter alignment */ - if ((0 == size) || (MV_IS_NOT_ALIGN(size, alignment))) - { - DB(mvOsPrintf("ctrlSizeToReg: ERR. Size is zero or not aligned.\n")); - return -1; - } - - /* Take out the "alignment" portion out of the size parameter */ - alignment--; /* Now the alignmet is a sequance of '1' (e.g. 0xffff) */ - /* and size is 0x1000000 (16MB) for example */ - while(alignment & 1) /* Check that alignmet LSB is set */ - { - size = (size >> 1); /* If LSB is set, move 'size' one bit to right */ - alignment = (alignment >> 1); - } - - /* If after the alignment first '0' was met we still have '1' in */ - /* it then aligment is invalid (not power of 2) */ - if (alignment) - { - DB(mvOsPrintf("ctrlSizeToReg: ERR. Alignment parameter 0x%x invalid.\n", - (MV_U32)alignment)); - return -1; - } - - /* Now the size is shifted right according to aligment: 0x0100 */ - size--; /* Now the size is a sequance of '1': 0x00ff */ - - retVal = size ; - - /* Check that LSB to MSB is sequence of 1's followed by sequence of 0's */ - while(size & 1) /* Check that LSB is set */ - { - size = (size >> 1); /* If LSB is set, move one bit to the right */ - } - - if (size) /* Sequance of 1's is over. Check that we have no other 1's */ - { - DB(mvOsPrintf("ctrlSizeToReg: ERR. Size parameter 0x%x invalid.\n", - size)); - return -1; - } - - return retVal; - -} - -/******************************************************************************* -* ctrlRegToSize - Extract size value from register value. -* -* DESCRIPTION: -* This function extract a size value from the register size parameter -* according to given aligment paramter. For example for register size -* value 0xff and aligment 0x10000 the function will return 0x01000000. -* -* INPUT: -* regSize - Size as in register format. See ctrlSizeToReg. -* alignment - Size alignment. Note that alignment must be power of 2! -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit describing size. -* If value is '-1' size parameter or aligment are invalid. -*******************************************************************************/ -MV_U32 ctrlRegToSize(MV_U32 regSize, MV_U32 alignment) -{ - MV_U32 temp; - - /* Check that LSB to MSB is sequence of 1's followed by sequence of 0's */ - temp = regSize; /* Now the size is a sequance of '1': 0x00ff */ - - while(temp & 1) /* Check that LSB is set */ - { - temp = (temp >> 1); /* If LSB is set, move one bit to the right */ - } - - if (temp) /* Sequance of 1's is over. Check that we have no other 1's */ - { - DB(mvOsPrintf("ctrlRegToSize: ERR. Size parameter 0x%x invalid.\n", - regSize)); - return -1; - } - - - /* Check that aligment is a power of two */ - temp = alignment - 1;/* Now the alignmet is a sequance of '1' (0xffff) */ - - while(temp & 1) /* Check that alignmet LSB is set */ - { - temp = (temp >> 1); /* If LSB is set, move 'size' one bit to right */ - } - - /* If after the 'temp' first '0' was met we still have '1' in 'temp' */ - /* then 'temp' is invalid (not power of 2) */ - if (temp) - { - DB(mvOsPrintf("ctrlSizeToReg: ERR. Alignment parameter 0x%x invalid.\n", - alignment)); - return -1; - } - - regSize++; /* Now the size is 0x0100 */ - - /* Add in the "alignment" portion to the register size parameter */ - alignment--; /* Now the alignmet is a sequance of '1' (e.g. 0xffff) */ - - while(alignment & 1) /* Check that alignmet LSB is set */ - { - regSize = (regSize << 1); /* LSB is set, move 'size' one bit left */ - alignment = (alignment >> 1); - } - - return regSize; -} - - -/******************************************************************************* -* ctrlSizeRegRoundUp - Round up given size -* -* DESCRIPTION: -* This function round up a given size to a size that fits the -* restrictions of size format given an aligment parameter. -* to given aligment paramter. For example for size parameter 0xa1000 and -* aligment 0x1000 the function will return 0xFF000. -* -* INPUT: -* size - Size. -* alignment - Size alignment. Note that alignment must be power of 2! -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit describing size value correspond to size in register. -*******************************************************************************/ -MV_U32 ctrlSizeRegRoundUp(MV_U32 size, MV_U32 alignment) -{ - MV_U32 msbBit = 0; - MV_U32 retSize; - - /* Check if size parameter is already comply with restriction */ - if (!(-1 == ctrlSizeToReg(size, alignment))) - { - return size; - } - - while(size) - { - size = (size >> 1); - msbBit++; - } - - retSize = (1 << msbBit); - - if (retSize < alignment) - { - return alignment; - } - else - { - return retSize; - } -} -/******************************************************************************* -* mvCtrlSysRstLengthCounterGet - Return number of milliseconds the reset button -* was pressed and clear counter -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: number of milliseconds the reset button was pressed -*******************************************************************************/ -MV_U32 mvCtrlSysRstLengthCounterGet(MV_VOID) -{ - static volatile MV_U32 Count = 0; - - if(!Count) { - Count = (MV_REG_READ(SYSRST_LENGTH_COUNTER_REG) & SLCR_COUNT_MASK); - Count = (Count / (MV_BOARD_REFCLK_25MHZ / 1000)); - /* clear counter for next boot */ - MV_REG_BIT_SET(SYSRST_LENGTH_COUNTER_REG, SLCR_CLR_MASK); - } - - DB(mvOsPrintf("mvCtrlSysRstLengthCounterGet: Reset button was pressed for %u milliseconds\n", Count)); - - return Count; -} - -MV_BOOL mvCtrlIsBootFromSPI(MV_VOID) -{ - MV_U32 satr = 0; - satr = MV_REG_READ(MPP_SAMPLE_AT_RESET); - if(mvCtrlModelGet() == MV_6180_DEV_ID) - { - if (MSAR_BOOT_MODE_6180(satr) == MSAR_BOOT_SPI_WITH_BOOTROM_6180) - return MV_TRUE; - else - return MV_FALSE; - } - satr = satr & MSAR_BOOT_MODE_MASK; - if (satr == MSAR_BOOT_SPI_WITH_BOOTROM) - return MV_TRUE; - else - return MV_FALSE; -} - -MV_BOOL mvCtrlIsBootFromSPIUseNAND(MV_VOID) -{ - MV_U32 satr = 0; - if(mvCtrlModelGet() == MV_6180_DEV_ID) - return MV_FALSE; - satr = MV_REG_READ(MPP_SAMPLE_AT_RESET); - satr = satr & MSAR_BOOT_MODE_MASK; - - if (satr == MSAR_BOOT_SPI_USE_NAND_WITH_BOOTROM) - return MV_TRUE; - else - return MV_FALSE; -} - -MV_BOOL mvCtrlIsBootFromNAND(MV_VOID) -{ - MV_U32 satr = 0; - satr = MV_REG_READ(MPP_SAMPLE_AT_RESET); - if(mvCtrlModelGet() == MV_6180_DEV_ID) - { - if (MSAR_BOOT_MODE_6180(satr) == MSAR_BOOT_NAND_WITH_BOOTROM_6180) - return MV_TRUE; - else - return MV_FALSE; - } - satr = satr & MSAR_BOOT_MODE_MASK; - if ((satr == MSAR_BOOT_NAND_WITH_BOOTROM)) - return MV_TRUE; - else - return MV_FALSE; -} - -#if defined(MV_INCLUDE_CLK_PWR_CNTRL) -/******************************************************************************* -* mvCtrlPwrSaveOn - Set Power save mode -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -*******************************************************************************/ -MV_VOID mvCtrlPwrSaveOn(MV_VOID) -{ - unsigned long old,temp; - /* Disable int */ - __asm__ __volatile__("mrs %0, cpsr\n" - "orr %1, %0, #0xc0\n" - "msr cpsr_c, %1" - : "=r" (old), "=r" (temp) - : - : "memory"); - - /* Set SoC in power save */ - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, BIT11); - /* Wait for int */ - __asm__ __volatile__("mcr p15, 0, r0, c7, c0, 4"); - - /* Enabled int */ - __asm__ __volatile__("msr cpsr_c, %0" - : - : "r" (old) - : "memory"); -} - - - -/******************************************************************************* -* mvCtrlPwrSaveOff - Go out of power save mode -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -*******************************************************************************/ -MV_VOID mvCtrlPwrSaveOff(MV_VOID) -{ - unsigned long old,temp; - /* Disable int */ - __asm__ __volatile__("mrs %0, cpsr\n" - "orr %1, %0, #0xc0\n" - "msr cpsr_c, %1" - : "=r" (old), "=r" (temp) - : - : "memory"); - - /* Set SoC in power save */ - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, BIT11); - /* Wait for int */ - __asm__ __volatile__("mcr p15, 0, r0, c7, c0, 4"); - - /* Enabled int */ - __asm__ __volatile__("msr cpsr_c, %0" - : - : "r" (old) - : "memory"); -} - -/******************************************************************************* -* mvCtrlPwrClckSet - Set Power State for specific Unit -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -*******************************************************************************/ -MV_VOID mvCtrlPwrClckSet(MV_UNIT_ID unitId, MV_U32 index, MV_BOOL enable) -{ - switch (unitId) - { -#if defined(MV_INCLUDE_PEX) - case PEX_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, PMC_PEXSTOPCLOCK_MASK); - } - else - { - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, PMC_PEXSTOPCLOCK_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_GIG_ETH) - case ETH_GIG_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, PMC_GESTOPCLOCK_MASK(index)); - } - else - { - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, PMC_GESTOPCLOCK_MASK(index)); - } - break; -#endif -#if defined(MV_INCLUDE_INTEG_SATA) - case SATA_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, PMC_SATASTOPCLOCK_MASK(index)); - } - else - { - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, PMC_SATASTOPCLOCK_MASK(index)); - } - break; -#endif -#if defined(MV_INCLUDE_CESA) - case CESA_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, PMC_SESTOPCLOCK_MASK); - } - else - { - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, PMC_SESTOPCLOCK_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_USB) - case USB_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, PMC_USBSTOPCLOCK_MASK); - } - else - { - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, PMC_USBSTOPCLOCK_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_AUDIO) - case AUDIO_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, PMC_AUDIOSTOPCLOCK_MASK); - } - else - { - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, PMC_AUDIOSTOPCLOCK_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_TS) - case TS_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, PMC_TSSTOPCLOCK_MASK); - } - else - { - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, PMC_TSSTOPCLOCK_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_SDIO) - case SDIO_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, PMC_SDIOSTOPCLOCK_MASK); - } - else - { - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, PMC_SDIOSTOPCLOCK_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_TDM) - case TDM_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_RESET(POWER_MNG_CTRL_REG, PMC_TDMSTOPCLOCK_MASK); - } - else - { - MV_REG_BIT_SET(POWER_MNG_CTRL_REG, PMC_TDMSTOPCLOCK_MASK); - } - break; -#endif - - default: - - break; - - } -} - -/******************************************************************************* -* mvCtrlPwrClckGet - Get Power State of specific Unit -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -******************************************************************************/ -MV_BOOL mvCtrlPwrClckGet(MV_UNIT_ID unitId, MV_U32 index) -{ - MV_U32 reg = MV_REG_READ(POWER_MNG_CTRL_REG); - MV_BOOL state = MV_TRUE; - - switch (unitId) - { -#if defined(MV_INCLUDE_PEX) - case PEX_UNIT_ID: - if ((reg & PMC_PEXSTOPCLOCK_MASK) == PMC_PEXSTOPCLOCK_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - - break; -#endif -#if defined(MV_INCLUDE_GIG_ETH) - case ETH_GIG_UNIT_ID: - if ((reg & PMC_GESTOPCLOCK_MASK(index)) == PMC_GESTOPCLOCK_STOP(index)) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_SATA) - case SATA_UNIT_ID: - if ((reg & PMC_SATASTOPCLOCK_MASK(index)) == PMC_SATASTOPCLOCK_STOP(index)) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_CESA) - case CESA_UNIT_ID: - if ((reg & PMC_SESTOPCLOCK_MASK) == PMC_SESTOPCLOCK_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_USB) - case USB_UNIT_ID: - if ((reg & PMC_USBSTOPCLOCK_MASK) == PMC_USBSTOPCLOCK_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_AUDIO) - case AUDIO_UNIT_ID: - if ((reg & PMC_AUDIOSTOPCLOCK_MASK) == PMC_AUDIOSTOPCLOCK_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_TS) - case TS_UNIT_ID: - if ((reg & PMC_TSSTOPCLOCK_MASK) == PMC_TSSTOPCLOCK_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_SDIO) - case SDIO_UNIT_ID: - if ((reg & PMC_SDIOSTOPCLOCK_MASK)== PMC_SDIOSTOPCLOCK_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_TDM) - case TDM_UNIT_ID: - if ((reg & PMC_TDMSTOPCLOCK_MASK) == PMC_TDMSTOPCLOCK_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif - - default: - state = MV_TRUE; - break; - } - - - return state; -} -/******************************************************************************* -* mvCtrlPwrMemSet - Set Power State for memory on specific Unit -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -*******************************************************************************/ -MV_VOID mvCtrlPwrMemSet(MV_UNIT_ID unitId, MV_U32 index, MV_BOOL enable) -{ - switch (unitId) - { -#if defined(MV_INCLUDE_PEX) - case PEX_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_SET(POWER_MNG_MEM_CTRL_REG, PMC_PEXSTOPMEM_MASK); - } - else - { - MV_REG_BIT_RESET(POWER_MNG_MEM_CTRL_REG, PMC_PEXSTOPMEM_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_GIG_ETH) - case ETH_GIG_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_SET(POWER_MNG_MEM_CTRL_REG, PMC_GESTOPMEM_MASK(index)); - } - else - { - MV_REG_BIT_RESET(POWER_MNG_MEM_CTRL_REG, PMC_GESTOPMEM_MASK(index)); - } - break; -#endif -#if defined(MV_INCLUDE_INTEG_SATA) - case SATA_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_SET(POWER_MNG_MEM_CTRL_REG, PMC_SATASTOPMEM_MASK(index)); - } - else - { - MV_REG_BIT_RESET(POWER_MNG_MEM_CTRL_REG, PMC_SATASTOPMEM_MASK(index)); - } - break; -#endif -#if defined(MV_INCLUDE_CESA) - case CESA_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_SET(POWER_MNG_MEM_CTRL_REG, PMC_SESTOPMEM_MASK); - } - else - { - MV_REG_BIT_RESET(POWER_MNG_MEM_CTRL_REG, PMC_SESTOPMEM_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_USB) - case USB_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_SET(POWER_MNG_MEM_CTRL_REG, PMC_USBSTOPMEM_MASK); - } - else - { - MV_REG_BIT_RESET(POWER_MNG_MEM_CTRL_REG, PMC_USBSTOPMEM_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_AUDIO) - case AUDIO_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_SET(POWER_MNG_MEM_CTRL_REG, PMC_AUDIOSTOPMEM_MASK); - } - else - { - MV_REG_BIT_RESET(POWER_MNG_MEM_CTRL_REG, PMC_AUDIOSTOPMEM_MASK); - } - break; -#endif -#if defined(MV_INCLUDE_XOR) - case XOR_UNIT_ID: - if (enable == MV_FALSE) - { - MV_REG_BIT_SET(POWER_MNG_MEM_CTRL_REG, PMC_XORSTOPMEM_MASK(index)); - } - else - { - MV_REG_BIT_RESET(POWER_MNG_MEM_CTRL_REG, PMC_XORSTOPMEM_MASK(index)); - } - break; -#endif - default: - - break; - - } -} - -/******************************************************************************* -* mvCtrlPwrMemGet - Get Power State of memory on specific Unit -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -******************************************************************************/ -MV_BOOL mvCtrlPwrMemGet(MV_UNIT_ID unitId, MV_U32 index) -{ - MV_U32 reg = MV_REG_READ(POWER_MNG_MEM_CTRL_REG); - MV_BOOL state = MV_TRUE; - - switch (unitId) - { -#if defined(MV_INCLUDE_PEX) - case PEX_UNIT_ID: - if ((reg & PMC_PEXSTOPMEM_MASK) == PMC_PEXSTOPMEM_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - - break; -#endif -#if defined(MV_INCLUDE_GIG_ETH) - case ETH_GIG_UNIT_ID: - if ((reg & PMC_GESTOPMEM_MASK(index)) == PMC_GESTOPMEM_STOP(index)) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_SATA) - case SATA_UNIT_ID: - if ((reg & PMC_SATASTOPMEM_MASK(index)) == PMC_SATASTOPMEM_STOP(index)) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_CESA) - case CESA_UNIT_ID: - if ((reg & PMC_SESTOPMEM_MASK) == PMC_SESTOPMEM_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_USB) - case USB_UNIT_ID: - if ((reg & PMC_USBSTOPMEM_MASK) == PMC_USBSTOPMEM_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_AUDIO) - case AUDIO_UNIT_ID: - if ((reg & PMC_AUDIOSTOPMEM_MASK) == PMC_AUDIOSTOPMEM_STOP) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif -#if defined(MV_INCLUDE_XOR) - case XOR_UNIT_ID: - if ((reg & PMC_XORSTOPMEM_MASK(index)) == PMC_XORSTOPMEM_STOP(index)) - { - state = MV_FALSE; - } - else state = MV_TRUE; - break; -#endif - - default: - state = MV_TRUE; - break; - } - - - return state; -} -#else -MV_VOID mvCtrlPwrClckSet(MV_UNIT_ID unitId, MV_U32 index, MV_BOOL enable) {return;} -MV_BOOL mvCtrlPwrClckGet(MV_UNIT_ID unitId, MV_U32 index) {return MV_TRUE;} -#endif /* #if defined(MV_INCLUDE_CLK_PWR_CNTRL) */ - - -/******************************************************************************* -* mvMPPConfigToSPI - Change MPP[3:0] configuration to SPI mode -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -******************************************************************************/ -MV_VOID mvMPPConfigToSPI(MV_VOID) -{ - MV_U32 mppVal = 0; - MV_U32 bootVal = 0; - - if(!mvCtrlIsBootFromSPIUseNAND()) - return; - mppVal = 0x00002220; /* Set MPP [3:1] to SPI mode */ - bootVal = MV_REG_READ(mvCtrlMppRegGet(0)); - bootVal &= 0xffff000f; - mppVal |= bootVal; - - MV_REG_WRITE(mvCtrlMppRegGet(0), mppVal); -} - - -/******************************************************************************* -* mvMPPConfigToDefault - Change MPP[7:0] configuration to default configuration -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -******************************************************************************/ -MV_VOID mvMPPConfigToDefault(MV_VOID) -{ - MV_U32 mppVal = 0; - MV_U32 bootVal = 0; - - if(!mvCtrlIsBootFromSPIUseNAND()) - return; - mppVal = mvBoardMppGet(0); - bootVal = MV_REG_READ(mvCtrlMppRegGet(0)); - mppVal &= ~0xffff000f; - bootVal &= 0xffff000f; - mppVal |= bootVal; - - MV_REG_WRITE(mvCtrlMppRegGet(0), mppVal); -} - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvLib.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvLib.h deleted file mode 100644 index 6e2e8137a7..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvLib.h +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __INCmvCtrlEnvLibh -#define __INCmvCtrlEnvLibh - -/* includes */ -#include "mvSysHwConfig.h" -#include "mvCommon.h" -#include "mvTypes.h" -#include "mvOs.h" -#include "boardEnv/mvBoardEnvLib.h" -#include "ctrlEnv/mvCtrlEnvSpec.h" -#include "ctrlEnv/mvCtrlEnvRegs.h" -#include "ctrlEnv/mvCtrlEnvAddrDec.h" - - -/* typedefs */ - -/* This enumerator describes the possible HW cache coherency policies the */ -/* controllers supports. */ -typedef enum _mvCachePolicy -{ - NO_COHERENCY, /* No HW cache coherency support */ - WT_COHERENCY, /* HW cache coherency supported in Write Through policy */ - WB_COHERENCY /* HW cache coherency supported in Write Back policy */ -}MV_CACHE_POLICY; - - -/* The swapping is referred to a 64-bit words (as this is the controller */ -/* internal data path width). This enumerator describes the possible */ -/* data swap types. Below is an example of the data 0x0011223344556677 */ -typedef enum _mvSwapType -{ - MV_BYTE_SWAP, /* Byte Swap 77 66 55 44 33 22 11 00 */ - MV_NO_SWAP, /* No swapping 00 11 22 33 44 55 66 77 */ - MV_BYTE_WORD_SWAP, /* Both byte and word swap 33 22 11 00 77 66 55 44 */ - MV_WORD_SWAP, /* Word swap 44 55 66 77 00 11 22 33 */ - SWAP_TYPE_MAX /* Delimiter for this enumerator */ -}MV_SWAP_TYPE; - -/* This structure describes access rights for Access protection windows */ -/* that can be found in IDMA, XOR, Ethernet and MPSC units. */ -/* Note that the permission enumerator coresponds to its register format. */ -/* For example, Read only premission is presented as "1" in register field. */ -typedef enum _mvAccessRights -{ - NO_ACCESS_ALLOWED = 0, /* No access allowed */ - READ_ONLY = 1, /* Read only permission */ - ACC_RESERVED = 2, /* Reserved access right */ - FULL_ACCESS = 3, /* Read and Write permission */ - MAX_ACC_RIGHTS -}MV_ACCESS_RIGHTS; - - -/* mcspLib.h API list */ - -MV_STATUS mvCtrlEnvInit(MV_VOID); -MV_U32 mvCtrlMppRegGet(MV_U32 mppGroup); - -#if defined(MV_INCLUDE_PEX) -MV_U32 mvCtrlPexMaxIfGet(MV_VOID); -#else -#define mvCtrlPexMaxIfGet() (0) -#endif - -#define mvCtrlPciIfMaxIfGet() (0) - -#if defined(MV_INCLUDE_GIG_ETH) -MV_U32 mvCtrlEthMaxPortGet(MV_VOID); -#endif -#if defined(MV_INCLUDE_XOR) -MV_U32 mvCtrlXorMaxChanGet(MV_VOID); -#endif -#if defined(MV_INCLUDE_USB) -MV_U32 mvCtrlUsbMaxGet(MV_VOID); -#endif -#if defined(MV_INCLUDE_NAND) -MV_U32 mvCtrlNandSupport(MV_VOID); -#endif -#if defined(MV_INCLUDE_SDIO) -MV_U32 mvCtrlSdioSupport(MV_VOID); -#endif -#if defined(MV_INCLUDE_TS) -MV_U32 mvCtrlTsSupport(MV_VOID); -#endif -#if defined(MV_INCLUDE_AUDIO) -MV_U32 mvCtrlAudioSupport(MV_VOID); -#endif -#if defined(MV_INCLUDE_TDM) -MV_U32 mvCtrlTdmSupport(MV_VOID); -#endif - -MV_U16 mvCtrlModelGet(MV_VOID); -MV_U8 mvCtrlRevGet(MV_VOID); -MV_STATUS mvCtrlNameGet(char *pNameBuff); -MV_U32 mvCtrlModelRevGet(MV_VOID); -MV_STATUS mvCtrlModelRevNameGet(char *pNameBuff); -MV_VOID mvCtrlAddrDecShow(MV_VOID); -const MV_8* mvCtrlTargetNameGet(MV_TARGET target); -MV_U32 ctrlSizeToReg(MV_U32 size, MV_U32 alignment); -MV_U32 ctrlRegToSize(MV_U32 regSize, MV_U32 alignment); -MV_U32 ctrlSizeRegRoundUp(MV_U32 size, MV_U32 alignment); -MV_U32 mvCtrlSysRstLengthCounterGet(MV_VOID); -MV_STATUS ctrlWinOverlapTest(MV_ADDR_WIN *pAddrWin1, MV_ADDR_WIN *pAddrWin2); -MV_STATUS ctrlWinWithinWinTest(MV_ADDR_WIN *pAddrWin1, MV_ADDR_WIN *pAddrWin2); - -MV_VOID mvCtrlPwrClckSet(MV_UNIT_ID unitId, MV_U32 index, MV_BOOL enable); -MV_BOOL mvCtrlPwrClckGet(MV_UNIT_ID unitId, MV_U32 index); -MV_VOID mvCtrlPwrMemSet(MV_UNIT_ID unitId, MV_U32 index, MV_BOOL enable); -MV_BOOL mvCtrlIsBootFromSPI(MV_VOID); -MV_BOOL mvCtrlIsBootFromSPIUseNAND(MV_VOID); -MV_BOOL mvCtrlIsBootFromNAND(MV_VOID); -#if defined(MV_INCLUDE_CLK_PWR_CNTRL) -MV_VOID mvCtrlPwrSaveOn(MV_VOID); -MV_VOID mvCtrlPwrSaveOff(MV_VOID); -#endif -MV_BOOL mvCtrlPwrMemGet(MV_UNIT_ID unitId, MV_U32 index); -MV_VOID mvMPPConfigToSPI(MV_VOID); -MV_VOID mvMPPConfigToDefault(MV_VOID); - - -#endif /* __INCmvCtrlEnvLibh */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvRegs.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvRegs.h deleted file mode 100644 index ae3f141a0d..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvRegs.h +++ /dev/null @@ -1,419 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCmvCtrlEnvRegsh -#define __INCmvCtrlEnvRegsh - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* CV Support */ -#define PEX0_MEM0 PEX0_MEM -#define PCI0_MEM0 PEX0_MEM - -/* Controller revision info */ -#define PCI_CLASS_CODE_AND_REVISION_ID 0x008 -#define PCCRIR_REVID_OFFS 0 /* Revision ID */ -#define PCCRIR_REVID_MASK (0xff << PCCRIR_REVID_OFFS) - -/* Controler environment registers offsets */ - -/* Power Managment Control */ -#define POWER_MNG_MEM_CTRL_REG 0x20118 - -#define PMC_GESTOPMEM_OFFS(port) ((port)? 13 : 0) -#define PMC_GESTOPMEM_MASK(port) (1 << PMC_GESTOPMEM_OFFS(port)) -#define PMC_GESTOPMEM_EN(port) (0 << PMC_GESTOPMEM_OFFS(port)) -#define PMC_GESTOPMEM_STOP(port) (1 << PMC_GESTOPMEM_OFFS(port)) - -#define PMC_PEXSTOPMEM_OFFS 1 -#define PMC_PEXSTOPMEM_MASK (1 << PMC_PEXSTOPMEM_OFFS) -#define PMC_PEXSTOPMEM_EN (0 << PMC_PEXSTOPMEM_OFFS) -#define PMC_PEXSTOPMEM_STOP (1 << PMC_PEXSTOPMEM_OFFS) - -#define PMC_USBSTOPMEM_OFFS 2 -#define PMC_USBSTOPMEM_MASK (1 << PMC_USBSTOPMEM_OFFS) -#define PMC_USBSTOPMEM_EN (0 << PMC_USBSTOPMEM_OFFS) -#define PMC_USBSTOPMEM_STOP (1 << PMC_USBSTOPMEM_OFFS) - -#define PMC_DUNITSTOPMEM_OFFS 3 -#define PMC_DUNITSTOPMEM_MASK (1 << PMC_DUNITSTOPMEM_OFFS) -#define PMC_DUNITSTOPMEM_EN (0 << PMC_DUNITSTOPMEM_OFFS) -#define PMC_DUNITSTOPMEM_STOP (1 << PMC_DUNITSTOPMEM_OFFS) - -#define PMC_RUNITSTOPMEM_OFFS 4 -#define PMC_RUNITSTOPMEM_MASK (1 << PMC_RUNITSTOPMEM_OFFS) -#define PMC_RUNITSTOPMEM_EN (0 << PMC_RUNITSTOPMEM_OFFS) -#define PMC_RUNITSTOPMEM_STOP (1 << PMC_RUNITSTOPMEM_OFFS) - -#define PMC_XORSTOPMEM_OFFS(port) (5+(port*2)) -#define PMC_XORSTOPMEM_MASK(port) (1 << PMC_XORSTOPMEM_OFFS(port)) -#define PMC_XORSTOPMEM_EN(port) (0 << PMC_XORSTOPMEM_OFFS(port)) -#define PMC_XORSTOPMEM_STOP(port) (1 << PMC_XORSTOPMEM_OFFS(port)) - -#define PMC_SATASTOPMEM_OFFS(port) (6+(port*5)) -#define PMC_SATASTOPMEM_MASK(port) (1 << PMC_SATASTOPMEM_OFFS(port)) -#define PMC_SATASTOPMEM_EN(port) (0 << PMC_SATASTOPMEM_OFFS(port)) -#define PMC_SATASTOPMEM_STOP(port) (1 << PMC_SATASTOPMEM_OFFS(port)) - -#define PMC_SESTOPMEM_OFFS 8 -#define PMC_SESTOPMEM_MASK (1 << PMC_SESTOPMEM_OFFS) -#define PMC_SESTOPMEM_EN (0 << PMC_SESTOPMEM_OFFS) -#define PMC_SESTOPMEM_STOP (1 << PMC_SESTOPMEM_OFFS) - -#define PMC_AUDIOSTOPMEM_OFFS 9 -#define PMC_AUDIOSTOPMEM_MASK (1 << PMC_AUDIOSTOPMEM_OFFS) -#define PMC_AUDIOSTOPMEM_EN (0 << PMC_AUDIOSTOPMEM_OFFS) -#define PMC_AUDIOSTOPMEM_STOP (1 << PMC_AUDIOSTOPMEM_OFFS) - -#define POWER_MNG_CTRL_REG 0x2011C - -#define PMC_GESTOPCLOCK_OFFS(port) ((port)? 19 : 0) -#define PMC_GESTOPCLOCK_MASK(port) (1 << PMC_GESTOPCLOCK_OFFS(port)) -#define PMC_GESTOPCLOCK_EN(port) (1 << PMC_GESTOPCLOCK_OFFS(port)) -#define PMC_GESTOPCLOCK_STOP(port) (0 << PMC_GESTOPCLOCK_OFFS(port)) - -#define PMC_PEXPHYSTOPCLOCK_OFFS 1 -#define PMC_PEXPHYSTOPCLOCK_MASK (1 << PMC_PEXPHYSTOPCLOCK_OFFS) -#define PMC_PEXPHYSTOPCLOCK_EN (1 << PMC_PEXPHYSTOPCLOCK_OFFS) -#define PMC_PEXPHYSTOPCLOCK_STOP (0 << PMC_PEXPHYSTOPCLOCK_OFFS) - -#define PMC_PEXSTOPCLOCK_OFFS 2 -#define PMC_PEXSTOPCLOCK_MASK (1 << PMC_PEXSTOPCLOCK_OFFS) -#define PMC_PEXSTOPCLOCK_EN (1 << PMC_PEXSTOPCLOCK_OFFS) -#define PMC_PEXSTOPCLOCK_STOP (0 << PMC_PEXSTOPCLOCK_OFFS) - -#define PMC_USBSTOPCLOCK_OFFS 3 -#define PMC_USBSTOPCLOCK_MASK (1 << PMC_USBSTOPCLOCK_OFFS) -#define PMC_USBSTOPCLOCK_EN (1 << PMC_USBSTOPCLOCK_OFFS) -#define PMC_USBSTOPCLOCK_STOP (0 << PMC_USBSTOPCLOCK_OFFS) - -#define PMC_SDIOSTOPCLOCK_OFFS 4 -#define PMC_SDIOSTOPCLOCK_MASK (1 << PMC_SDIOSTOPCLOCK_OFFS) -#define PMC_SDIOSTOPCLOCK_EN (1 << PMC_SDIOSTOPCLOCK_OFFS) -#define PMC_SDIOSTOPCLOCK_STOP (0 << PMC_SDIOSTOPCLOCK_OFFS) - -#define PMC_TSSTOPCLOCK_OFFS 5 -#define PMC_TSSTOPCLOCK_MASK (1 << PMC_TSSTOPCLOCK_OFFS) -#define PMC_TSSTOPCLOCK_EN (1 << PMC_TSSTOPCLOCK_OFFS) -#define PMC_TSSTOPCLOCK_STOP (0 << PMC_TSSTOPCLOCK_OFFS) - -#define PMC_AUDIOSTOPCLOCK_OFFS 9 -#define PMC_AUDIOSTOPCLOCK_MASK (1 << PMC_AUDIOSTOPCLOCK_OFFS) -#define PMC_AUDIOSTOPCLOCK_EN (1 << PMC_AUDIOSTOPCLOCK_OFFS) -#define PMC_AUDIOSTOPCLOCK_STOP (0 << PMC_AUDIOSTOPCLOCK_OFFS) - -#define PMC_POWERSAVE_OFFS 11 -#define PMC_POWERSAVE_MASK (1 << PMC_POWERSAVE_OFFS) -#define PMC_POWERSAVE_EN (1 << PMC_POWERSAVE_OFFS) -#define PMC_POWERSAVE_STOP (0 << PMC_POWERSAVE_OFFS) - - - - -#define PMC_SATASTOPCLOCK_OFFS(port) (14+(port)) -#define PMC_SATASTOPCLOCK_MASK(port) (1 << PMC_SATASTOPCLOCK_OFFS(port)) -#define PMC_SATASTOPCLOCK_EN(port) (1 << PMC_SATASTOPCLOCK_OFFS(port)) -#define PMC_SATASTOPCLOCK_STOP(port) (0 << PMC_SATASTOPCLOCK_OFFS(port)) - -#define PMC_SESTOPCLOCK_OFFS 17 -#define PMC_SESTOPCLOCK_MASK (1 << PMC_SESTOPCLOCK_OFFS) -#define PMC_SESTOPCLOCK_EN (1 << PMC_SESTOPCLOCK_OFFS) -#define PMC_SESTOPCLOCK_STOP (0 << PMC_SESTOPCLOCK_OFFS) - -#define PMC_TDMSTOPCLOCK_OFFS 20 -#define PMC_TDMSTOPCLOCK_MASK (1 << PMC_TDMSTOPCLOCK_OFFS) -#define PMC_TDMSTOPCLOCK_EN (1 << PMC_TDMSTOPCLOCK_OFFS) -#define PMC_TDMSTOPCLOCK_STOP (0 << PMC_TDMSTOPCLOCK_OFFS) - - -/* Controler environment registers offsets */ -#define MPP_CONTROL_REG0 0x10000 -#define MPP_CONTROL_REG1 0x10004 -#define MPP_CONTROL_REG2 0x10008 -#define MPP_CONTROL_REG3 0x1000C -#define MPP_CONTROL_REG4 0x10010 -#define MPP_CONTROL_REG5 0x10014 -#define MPP_CONTROL_REG6 0x10018 -#define MPP_SAMPLE_AT_RESET 0x10030 -#define CHIP_BOND_REG 0x10034 -#define SYSRST_LENGTH_COUNTER_REG 0x10050 -#define SLCR_COUNT_OFFS 0 -#define SLCR_COUNT_MASK (0x1FFFFFFF << SLCR_COUNT_OFFS) -#define SLCR_CLR_OFFS 31 -#define SLCR_CLR_MASK (1 << SLCR_CLR_OFFS) -#define PCKG_OPT_MASK 0x3 -#define MPP_OUTPUT_DRIVE_REG 0x100E0 -#define MPP_RGMII0_OUTPUT_DRIVE_OFFS 7 -#define MPP_3_3_RGMII0_OUTPUT_DRIVE (0x0 << MPP_RGMII0_OUTPUT_DRIVE_OFFS) -#define MPP_1_8_RGMII0_OUTPUT_DRIVE (0x1 << MPP_RGMII0_OUTPUT_DRIVE_OFFS) -#define MPP_RGMII1_OUTPUT_DRIVE_OFFS 15 -#define MPP_3_3_RGMII1_OUTPUT_DRIVE (0x0 << MPP_RGMII1_OUTPUT_DRIVE_OFFS) -#define MPP_1_8_RGMII1_OUTPUT_DRIVE (0x1 << MPP_RGMII1_OUTPUT_DRIVE_OFFS) - -#define MSAR_BOOT_MODE_OFFS 12 -#define MSAR_BOOT_MODE_MASK (0x7 << MSAR_BOOT_MODE_OFFS) -#define MSAR_BOOT_NAND_WITH_BOOTROM (0x5 << MSAR_BOOT_MODE_OFFS) -#define MSAR_BOOT_SPI_WITH_BOOTROM (0x4 << MSAR_BOOT_MODE_OFFS) -#define MSAR_BOOT_SPI_USE_NAND_WITH_BOOTROM (0x2 << MSAR_BOOT_MODE_OFFS) - -#define MSAR_BOOT_MODE_6180(X) (((X & 0x3000) >> 12) | \ - ((X & 0x2) << 1)) -#define MSAR_BOOT_SPI_WITH_BOOTROM_6180 0x1 -#define MSAR_BOOT_NAND_WITH_BOOTROM_6180 0x5 - -#define MSAR_TCLCK_OFFS 21 -#define MSAR_TCLCK_MASK (0x1 << MSAR_TCLCK_OFFS) -#define MSAR_TCLCK_166 (0x1 << MSAR_TCLCK_OFFS) -#define MSAR_TCLCK_200 (0x0 << MSAR_TCLCK_OFFS) - - -#define MSAR_CPUCLCK_EXTRACT(X) (((X & 0x2) >> 1) | ((X & 0x400000) >> 21) | \ - ((X & 0x18) >> 1)) - -#define MSAR_CPUCLCK_OFFS_6180 2 -#define MSAR_CPUCLCK_MASK_6180 (0x7 << MSAR_CPUCLCK_OFFS_6180) - -#define MSAR_DDRCLCK_RTIO_OFFS 5 -#define MSAR_DDRCLCK_RTIO_MASK (0xF << MSAR_DDRCLCK_RTIO_OFFS) - -#define MSAR_L2CLCK_EXTRACT(X) (((X & 0x600) >> 9) | ((X & 0x80000) >> 17)) - -#ifndef MV_ASMLANGUAGE -/* CPU clock for 6281,6192 0->Resereved */ -#define MV_CPU_CLCK_TBL { 0, 0, 0, 0, \ - 600000000, 0, 800000000, 1000000000, \ - 0, 1200000000, 0, 0, \ - 1500000000, 0, 0, 0} - -/* DDR clock RATIO for 6281,6192 {0,0}->Reserved */ -#define MV_DDR_CLCK_RTIO_TBL {\ - {0, 0}, {0, 0}, {2, 1}, {0, 0}, \ - {3, 1}, {0, 0}, {4, 1}, {9, 2}, \ - {5, 1}, {6, 1}, {0, 0}, {0, 0}, \ - {0, 0}, {0, 0}, {0, 0}, {0, 0} \ -} - -/* L2 clock RATIO for 6281,6192 {1,1}->Reserved */ -#define MV_L2_CLCK_RTIO_TBL {\ - {0, 0}, {2, 1}, {0, 0}, {3, 1}, \ - {0, 0}, {0, 0}, {0, 0}, {0, 0} \ -} - -/* 6180 have different clk reset sampling */ -/* ARM CPU, DDR, L2 clock for 6180 {0,0,0}->Reserved */ -#define MV_CPU6180_DDR_L2_CLCK_TBL { \ - {0, 0, 0 },\ - {0, 0, 0 },\ - {0, 0, 0 },\ - {0, 0, 0 },\ - {0, 0, 0 },\ - {600000000, 200000000, 300000000 },\ - {800000000, 200000000, 400000000 },\ - {0, 0, 0 }\ -} - - - -/* These macros help units to identify a target Mbus Arbiter group */ -#define MV_TARGET_IS_DRAM(target) \ - ((target >= SDRAM_CS0) && (target <= SDRAM_CS3)) - -#define MV_TARGET_IS_PEX0(target) \ - ((target >= PEX0_MEM) && (target <= PEX0_IO)) - -#define MV_TARGET_IS_PEX1(target) 0 - -#define MV_TARGET_IS_PEX(target) (MV_TARGET_IS_PEX0(target) || MV_TARGET_IS_PEX1(target)) - -#define MV_TARGET_IS_DEVICE(target) \ - ((target >= DEVICE_CS0) && (target <= DEVICE_CS3)) - -#define MV_PCI_DRAM_BAR_TO_DRAM_TARGET(bar) 0 - -#define MV_TARGET_IS_AS_BOOT(target) ((target) == (sampleAtResetTargetArray[ \ - (mvCtrlModelGet() == MV_6180_DEV_ID)? MSAR_BOOT_MODE_6180 \ - (MV_REG_READ(MPP_SAMPLE_AT_RESET)):((MV_REG_READ(MPP_SAMPLE_AT_RESET)\ - & MSAR_BOOT_MODE_MASK) >> MSAR_BOOT_MODE_OFFS)])) - - -#define MV_CHANGE_BOOT_CS(target) (((target) == DEV_BOOCS)?\ - sampleAtResetTargetArray[(mvCtrlModelGet() == MV_6180_DEV_ID)? \ - MSAR_BOOT_MODE_6180(MV_REG_READ(MPP_SAMPLE_AT_RESET)): \ - ((MV_REG_READ(MPP_SAMPLE_AT_RESET) & MSAR_BOOT_MODE_MASK)\ - >> MSAR_BOOT_MODE_OFFS)]:(target)) - -#define TCLK_TO_COUNTER_RATIO 1 /* counters running in Tclk */ - -#define BOOT_TARGETS_NAME_ARRAY { \ - TBL_TERM, \ - TBL_TERM, \ - BOOT_ROM_CS, \ - TBL_TERM, \ - BOOT_ROM_CS, \ - BOOT_ROM_CS, \ - TBL_TERM, \ - TBL_TERM \ -} - -#define BOOT_TARGETS_NAME_ARRAY_6180 { \ - TBL_TERM, \ - BOOT_ROM_CS, \ - TBL_TERM, \ - TBL_TERM, \ - TBL_TERM, \ - BOOT_ROM_CS, \ - TBL_TERM, \ - TBL_TERM \ -} - - -/* For old competability */ -#define DEVICE_CS0 NFLASH_CS -#define DEVICE_CS1 SPI_CS -#define DEVICE_CS2 BOOT_ROM_CS -#define DEVICE_CS3 DEV_BOOCS -#define MV_BOOTDEVICE_INDEX 0 - -#define START_DEV_CS DEV_CS0 -#define DEV_TO_TARGET(dev) ((dev) + DEVICE_CS0) - -#define PCI_IF0_MEM0 PEX0_MEM -#define PCI_IF0_IO PEX0_IO - - -/* This enumerator defines the Marvell controller target ID */ -typedef enum _mvTargetId -{ - DRAM_TARGET_ID = 0 , /* Port 0 -> DRAM interface */ - DEV_TARGET_ID = 1, /* Port 1 -> Nand/SPI */ - PEX0_TARGET_ID = 4 , /* Port 4 -> PCI Express0 */ - CRYPT_TARGET_ID = 3 , /* Port 3 --> Crypto Engine */ - SAGE_TARGET_ID = 12 , /* Port 12 -> SAGE Unit */ - MAX_TARGETS_ID -}MV_TARGET_ID; - - -/* This enumerator described the possible Controller paripheral targets. */ -/* Controller peripherals are designated memory/IO address spaces that the */ -/* controller can access. They are also refered as "targets" */ -typedef enum _mvTarget -{ - TBL_TERM = -1, /* none valid target, used as targets list terminator*/ - SDRAM_CS0, /* SDRAM chip select 0 */ - SDRAM_CS1, /* SDRAM chip select 1 */ - SDRAM_CS2, /* SDRAM chip select 2 */ - SDRAM_CS3, /* SDRAM chip select 3 */ - PEX0_MEM, /* PCI Express 0 Memory */ - PEX0_IO, /* PCI Express 0 IO */ - INTER_REGS, /* Internal registers */ - NFLASH_CS, /* NFLASH_CS */ - SPI_CS, /* SPI_CS */ - BOOT_ROM_CS, /* BOOT_ROM_CS */ - DEV_BOOCS, /* DEV_BOOCS */ - CRYPT_ENG, /* Crypto Engine */ -#ifdef MV_INCLUDE_SAGE - SAGE_UNIT, /* SAGE Unit */ -#endif - MAX_TARGETS - -}MV_TARGET; - -#define TARGETS_DEF_ARRAY { \ - {0x0E, DRAM_TARGET_ID }, /* SDRAM_CS0 */ \ - {0x0D, DRAM_TARGET_ID }, /* SDRAM_CS1 */ \ - {0x0B, DRAM_TARGET_ID }, /* SDRAM_CS0 */ \ - {0x07, DRAM_TARGET_ID }, /* SDRAM_CS1 */ \ - {0xE8, PEX0_TARGET_ID }, /* PEX0_MEM */ \ - {0xE0, PEX0_TARGET_ID }, /* PEX0_IO */ \ - {0xFF, 0xFF }, /* INTER_REGS */ \ - {0x2F, DEV_TARGET_ID }, /* NFLASH_CS */ \ - {0x1E, DEV_TARGET_ID }, /* SPI_CS */ \ - {0x1D, DEV_TARGET_ID }, /* BOOT_ROM_CS */ \ - {0x1E, DEV_TARGET_ID }, /* DEV_BOOCS */ \ - {0x01, CRYPT_TARGET_ID}, /* CRYPT_ENG */ \ - {0x00, SAGE_TARGET_ID } \ -} - - -#define TARGETS_NAME_ARRAY { \ - "SDRAM_CS0", /* SDRAM_CS0 */ \ - "SDRAM_CS1", /* SDRAM_CS1 */ \ - "SDRAM_CS2", /* SDRAM_CS2 */ \ - "SDRAM_CS3", /* SDRAM_CS3 */ \ - "PEX0_MEM", /* PEX0_MEM */ \ - "PEX0_IO", /* PEX0_IO */ \ - "INTER_REGS", /* INTER_REGS */ \ - "NFLASH_CS", /* NFLASH_CS */ \ - "SPI_CS", /* SPI_CS */ \ - "BOOT_ROM_CS", /* BOOT_ROM_CS */ \ - "DEV_BOOTCS", /* DEV_BOOCS */ \ - "CRYPT_ENG", /* CRYPT_ENG */ \ - "SAGE_UNIT" /* SAGE_UNIT */ \ -} -#endif /* MV_ASMLANGUAGE */ - - -#endif diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvSpec.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvSpec.h deleted file mode 100644 index e41d80a426..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/mvCtrlEnvSpec.h +++ /dev/null @@ -1,257 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCmvCtrlEnvSpech -#define __INCmvCtrlEnvSpech - -#include "mvDeviceId.h" -#include "mvSysHwConfig.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define MV_ARM_SOC -#define SOC_NAME_PREFIX "MV88F" - - -/* units base and port numbers */ -#ifdef MV_ASMLANGUAGE -#define XOR_UNIT_BASE(unit) 0x60800 -#else -#define MV_XOR_REG_BASE 0x60000 -#define XOR_UNIT_BASE(unit) ((unit)? 0x60900:0x60800) -#endif - -#define TDM_REG_BASE 0xD0000 -#define USB_REG_BASE(dev) 0x50000 -#define AUDIO_REG_BASE 0xA0000 -#define SATA_REG_BASE 0x80000 -#define MV_CESA_REG_BASE 0x3D000 -#define MV_CESA_TDMA_REG_BASE 0x30000 -#define MV_SDIO_REG_BASE 0x90000 -#define MV_ETH_REG_BASE(port) (((port) == 0) ? 0x72000 : 0x76000) -#define MV_UART_CHAN_BASE(chanNum) (0x12000 + (chanNum * 0x100)) -#define DRAM_BASE 0x0 -#define CNTMR_BASE 0x20300 -#define TWSI_SLAVE_BASE(chanNum) 0x11000 -#define PEX_IF_BASE(pexIf) 0x40000 -#define MPP_REG_BASE 0x10000 -#define TSU_GLOBAL_REG_BASE 0xB4000 -#define MAX_AHB_TO_MBUS_REG_BASE 0x20000 - -#define INTER_REGS_SIZE _1M -/* This define describes the TWSI interrupt bit and location */ -#define TWSI_CPU_MAIN_INT_CAUSE_REG 0x20200 -#define TWSI0_CPU_MAIN_INT_BIT (1<<29) -#define TWSI_SPEED 100000 - -#define MV_GPP_MAX_GROUP 2 -#define MV_CNTMR_MAX_COUNTER 2 -#define MV_UART_MAX_CHAN 2 -#define MV_XOR_MAX_UNIT 2 -#define MV_XOR_MAX_CHAN 4 /* total channels for all units together*/ -#define MV_XOR_MAX_CHAN_PER_UNIT 2 /* channels for units */ -#define MV_SATA_MAX_CHAN 2 - -#define MV_6281_MPP_MAX_MODULE 2 -#define MV_6192_MPP_MAX_MODULE 1 -#define MV_6190_MPP_MAX_MODULE 1 -#define MV_6180_MPP_MAX_MODULE 2 -#define MV_6281_MPP_MAX_GROUP 7 -#define MV_6192_MPP_MAX_GROUP 4 -#define MV_6190_MPP_MAX_GROUP 4 -#define MV_6180_MPP_MAX_GROUP 3 - -#define MV_DRAM_MAX_CS 4 - -/* This define describes the maximum number of supported PCI\PCIX Interfaces*/ -#define MV_PCI_MAX_IF 0 -#define MV_PCI_START_IF 0 - -/* This define describes the maximum number of supported PEX Interfaces */ -#define MV_INCLUDE_PEX0 -#define MV_DISABLE_PEX_DEVICE_BAR -#define MV_PEX_MAX_IF 1 -#define MV_PEX_START_IF MV_PCI_MAX_IF - -/* This define describes the maximum number of supported PCI Interfaces */ -#define MV_PCI_IF_MAX_IF (MV_PEX_MAX_IF+MV_PCI_MAX_IF) - -#define MV_ETH_MAX_PORTS 2 -#define MV_6281_ETH_MAX_PORTS 2 -#define MV_6192_ETH_MAX_PORTS 2 -#define MV_6190_ETH_MAX_PORTS 1 -#define MV_6180_ETH_MAX_PORTS 1 - -#define MV_IDMA_MAX_CHAN 0 - -#define MV_USB_MAX_PORTS 1 - -#define MV_USB_VERSION 1 - - -#define MV_6281_NAND 1 -#define MV_6192_NAND 1 -#define MV_6190_NAND 1 -#define MV_6180_NAND 0 - -#define MV_6281_SDIO 1 -#define MV_6192_SDIO 1 -#define MV_6190_SDIO 1 -#define MV_6180_SDIO 1 - -#define MV_6281_TS 1 -#define MV_6192_TS 1 -#define MV_6190_TS 0 -#define MV_6180_TS 0 - -#define MV_6281_AUDIO 1 -#define MV_6192_AUDIO 1 -#define MV_6190_AUDIO 0 -#define MV_6180_AUDIO 1 - -#define MV_6281_TDM 1 -#define MV_6192_TDM 1 -#define MV_6190_TDM 0 -#define MV_6180_TDM 0 - -#define MV_DEVICE_MAX_CS 4 - -/* Others */ -#define PEX_HOST_BUS_NUM(pciIf) (pciIf) -#define PEX_HOST_DEV_NUM(pciIf) 0 - -#define PCI_IO(pciIf) (PEX0_IO) -#define PCI_MEM(pciIf, memNum) (PEX0_MEM0) -/* CESA version #2: One channel, 2KB SRAM, TDMA */ -#if defined(MV_CESA_CHAIN_MODE_SUPPORT) - #define MV_CESA_VERSION 3 -#else -#define MV_CESA_VERSION 2 -#endif -#define MV_CESA_SRAM_SIZE 2*1024 -/* This define describes the maximum number of supported Ethernet ports */ -#define MV_ETH_VERSION 4 -#define MV_ETH_MAX_RXQ 8 -#define MV_ETH_MAX_TXQ 8 -#define MV_ETH_PORT_SGMII { MV_FALSE, MV_FALSE } -/* This define describes the the support of USB */ -#define MV_USB_VERSION 1 - -#define MV_INCLUDE_SDRAM_CS0 -#define MV_INCLUDE_SDRAM_CS1 -#define MV_INCLUDE_SDRAM_CS2 -#define MV_INCLUDE_SDRAM_CS3 - -#define MV_INCLUDE_DEVICE_CS0 -#define MV_INCLUDE_DEVICE_CS1 -#define MV_INCLUDE_DEVICE_CS2 -#define MV_INCLUDE_DEVICE_CS3 - -#define MPP_GROUP_1_TYPE {\ - {0, 0, 0}, /* Reserved for AUTO */ \ - {0x22220000, 0x22222222, 0x2222}, /* TDM */ \ - {0x44440000, 0x00044444, 0x0000}, /* AUDIO */ \ - {0x33330000, 0x33003333, 0x0033}, /* RGMII */ \ - {0x33330000, 0x03333333, 0x0033}, /* GMII */ \ - {0x11110000, 0x11111111, 0x0001}, /* TS */ \ - {0x33330000, 0x33333333, 0x3333} /* MII */ \ -} - -#define MPP_GROUP_2_TYPE {\ - {0, 0, 0}, /* Reserved for AUTO */ \ - {0x22220000, 0x22222222, 0x22}, /* TDM */ \ - {0x44440000, 0x00044444, 0x0}, /* AUDIO */ \ - {0, 0, 0}, /* N_A */ \ - {0, 0, 0}, /* N_A */ \ - {0x11110000, 0x11111111, 0x01} /* TS */ \ -} - -#ifndef MV_ASMLANGUAGE - -/* This enumerator defines the Marvell Units ID */ -typedef enum _mvUnitId -{ - DRAM_UNIT_ID, - PEX_UNIT_ID, - ETH_GIG_UNIT_ID, - USB_UNIT_ID, - IDMA_UNIT_ID, - XOR_UNIT_ID, - SATA_UNIT_ID, - TDM_UNIT_ID, - UART_UNIT_ID, - CESA_UNIT_ID, - SPI_UNIT_ID, - AUDIO_UNIT_ID, - SDIO_UNIT_ID, - TS_UNIT_ID, - MAX_UNITS_ID - -}MV_UNIT_ID; - -#endif - -#endif /* __INCmvCtrlEnvSpech */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvAhbToMbus.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvAhbToMbus.c deleted file mode 100644 index d21bb074d2..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvAhbToMbus.c +++ /dev/null @@ -1,1048 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -/* includes */ -#include "ctrlEnv/sys/mvAhbToMbus.h" -#include "ctrlEnv/mvCtrlEnvAddrDec.h" - -#undef MV_DEBUG -/* defines */ -#ifdef MV_DEBUG - #define DB(x) x -#else - #define DB(x) -#endif - -/* typedefs */ - - -/* CPU address remap registers offsets are inconsecutive. This struct */ -/* describes address remap register offsets */ -typedef struct _ahbToMbusRemapRegOffs -{ - MV_U32 lowRegOffs; /* Low 32-bit remap register offset */ - MV_U32 highRegOffs; /* High 32 bit remap register offset */ -}AHB_TO_MBUS_REMAP_REG_OFFS; - -/* locals */ -static MV_STATUS ahbToMbusRemapRegOffsGet (MV_U32 winNum, - AHB_TO_MBUS_REMAP_REG_OFFS *pRemapRegs); - -/******************************************************************************* -* mvAhbToMbusInit - Initialize Ahb To Mbus Address Map ! -* -* DESCRIPTION: -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_OK laways. -* -*******************************************************************************/ -MV_STATUS mvAhbToMbusInit(void) -{ - return MV_OK; - -} - -/******************************************************************************* -* mvAhbToMbusWinSet - Set CPU-to-peripheral winNum address window -* -* DESCRIPTION: -* This function sets -* address window, also known as address decode window. -* A new address decode window is set for specified winNum address window. -* If address decode window parameter structure enables the window, -* the routine will also enable the winNum window, allowing CPU to access -* the winNum window. -* -* INPUT: -* winNum - Windows number. -* pAddrDecWin - CPU winNum window data structure. -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_OK if CPU winNum window was set correctly, MV_ERROR in case of -* address window overlapps with other active CPU winNum window or -* trying to assign 36bit base address while CPU does not support that. -* The function returns MV_NOT_SUPPORTED, if the winNum is unsupported. -* -*******************************************************************************/ -MV_STATUS mvAhbToMbusWinSet(MV_U32 winNum, MV_AHB_TO_MBUS_DEC_WIN *pAddrDecWin) -{ - MV_TARGET_ATTRIB targetAttribs; - MV_DEC_REGS decRegs; - - /* Parameter checking */ - if (winNum >= MAX_AHB_TO_MBUS_WINS) - { - mvOsPrintf("mvAhbToMbusWinSet: ERR. Invalid winNum %d\n", winNum); - return MV_NOT_SUPPORTED; - } - - - /* read base register*/ - if (winNum != MV_AHB_TO_MBUS_INTREG_WIN) - { - decRegs.baseReg = MV_REG_READ(AHB_TO_MBUS_WIN_BASE_REG(winNum)); - } - else - { - decRegs.baseReg = MV_REG_READ(AHB_TO_MBUS_WIN_INTEREG_REG); - } - - /* check if address is aligned to the size */ - if(MV_IS_NOT_ALIGN(pAddrDecWin->addrWin.baseLow, pAddrDecWin->addrWin.size)) - { - mvOsPrintf("mvAhbToMbusWinSet:Error setting AHB to MBUS window %d to "\ - "target %s.\nAddress 0x%08x is unaligned to size 0x%x.\n", - winNum, - mvCtrlTargetNameGet(pAddrDecWin->target), - pAddrDecWin->addrWin.baseLow, - pAddrDecWin->addrWin.size); - return MV_ERROR; - } - - /* read control register*/ - if (winNum != MV_AHB_TO_MBUS_INTREG_WIN) - { - decRegs.sizeReg = MV_REG_READ(AHB_TO_MBUS_WIN_CTRL_REG(winNum)); - } - - if (MV_OK != mvCtrlAddrDecToReg(&(pAddrDecWin->addrWin),&decRegs)) - { - mvOsPrintf("mvAhbToMbusWinSet:mvCtrlAddrDecToReg Failed\n"); - return MV_ERROR; - } - - /* enable\Disable */ - if (MV_TRUE == pAddrDecWin->enable) - { - decRegs.sizeReg |= ATMWCR_WIN_ENABLE; - } - else - { - decRegs.sizeReg &= ~ATMWCR_WIN_ENABLE; - } - - mvCtrlAttribGet(pAddrDecWin->target,&targetAttribs); - - /* set attributes */ - decRegs.sizeReg &= ~ATMWCR_WIN_ATTR_MASK; - decRegs.sizeReg |= targetAttribs.attrib << ATMWCR_WIN_ATTR_OFFS; - /* set target ID */ - decRegs.sizeReg &= ~ATMWCR_WIN_TARGET_MASK; - decRegs.sizeReg |= targetAttribs.targetId << ATMWCR_WIN_TARGET_OFFS; - -#if !defined(MV_RUN_FROM_FLASH) - /* To be on the safe side we disable the window before writing the */ - /* new values. */ - if (winNum != MV_AHB_TO_MBUS_INTREG_WIN) - { - mvAhbToMbusWinEnable(winNum,MV_FALSE); - } -#endif - - /* 3) Write to address decode Base Address Register */ - if (winNum != MV_AHB_TO_MBUS_INTREG_WIN) - { - MV_REG_WRITE(AHB_TO_MBUS_WIN_BASE_REG(winNum), decRegs.baseReg); - } - else - { - MV_REG_WRITE(AHB_TO_MBUS_WIN_INTEREG_REG, decRegs.baseReg); - } - - - /* Internal register space have no size */ - /* register. Do not perform size register assigment for those targets */ - if (winNum != MV_AHB_TO_MBUS_INTREG_WIN) - { - /* Write to address decode Size Register */ - MV_REG_WRITE(AHB_TO_MBUS_WIN_CTRL_REG(winNum), decRegs.sizeReg); - } - - return MV_OK; -} - -/******************************************************************************* -* mvAhbToMbusWinGet - Get CPU-to-peripheral winNum address window -* -* DESCRIPTION: -* Get the CPU peripheral winNum address window. -* -* INPUT: -* winNum - Peripheral winNum enumerator -* -* OUTPUT: -* pAddrDecWin - CPU winNum window information data structure. -* -* RETURN: -* MV_OK if winNum exist, MV_ERROR otherwise. -* -*******************************************************************************/ -MV_STATUS mvAhbToMbusWinGet(MV_U32 winNum, MV_AHB_TO_MBUS_DEC_WIN *pAddrDecWin) -{ - MV_DEC_REGS decRegs; - MV_TARGET_ATTRIB targetAttrib; - - - /* Parameter checking */ - if (winNum >= MAX_AHB_TO_MBUS_WINS) - { - mvOsPrintf("mvAhbToMbusWinGet: ERR. Invalid winNum %d\n", winNum); - return MV_NOT_SUPPORTED; - } - - - /* Internal register space size have no size register*/ - if (winNum != MV_AHB_TO_MBUS_INTREG_WIN) - { - decRegs.sizeReg = MV_REG_READ(AHB_TO_MBUS_WIN_CTRL_REG(winNum)); - } - else - { - decRegs.sizeReg = 0; - } - - - /* Read base and size */ - if (winNum != MV_AHB_TO_MBUS_INTREG_WIN) - { - decRegs.baseReg = MV_REG_READ(AHB_TO_MBUS_WIN_BASE_REG(winNum)); - } - else - { - decRegs.baseReg = MV_REG_READ(AHB_TO_MBUS_WIN_INTEREG_REG); - } - - - - if (MV_OK != mvCtrlRegToAddrDec(&decRegs,&(pAddrDecWin->addrWin))) - { - mvOsPrintf("mvAhbToMbusWinGet: mvCtrlRegToAddrDec Failed \n"); - return MV_ERROR; - } - - if (winNum == MV_AHB_TO_MBUS_INTREG_WIN) - { - pAddrDecWin->addrWin.size = INTER_REGS_SIZE; - pAddrDecWin->target = INTER_REGS; - pAddrDecWin->enable = MV_TRUE; - - return MV_OK; - } - - - if (decRegs.sizeReg & ATMWCR_WIN_ENABLE) - { - pAddrDecWin->enable = MV_TRUE; - } - else - { - pAddrDecWin->enable = MV_FALSE; - - } - - - - if (-1 == pAddrDecWin->addrWin.size) - { - return MV_ERROR; - } - - /* attrib and targetId */ - targetAttrib.attrib = (decRegs.sizeReg & ATMWCR_WIN_ATTR_MASK) >> - ATMWCR_WIN_ATTR_OFFS; - targetAttrib.targetId = (decRegs.sizeReg & ATMWCR_WIN_TARGET_MASK) >> - ATMWCR_WIN_TARGET_OFFS; - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - return MV_OK; -} - -/******************************************************************************* -* mvAhbToMbusWinTargetGet - Get Window number associated with target -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -* -*******************************************************************************/ -MV_U32 mvAhbToMbusWinTargetGet(MV_TARGET target) -{ - MV_AHB_TO_MBUS_DEC_WIN decWin; - MV_U32 winNum; - - /* Check parameters */ - if (target >= MAX_TARGETS) - { - mvOsPrintf("mvAhbToMbusWinTargetGet: target %d is Illigal\n", target); - return 0xffffffff; - } - - if (INTER_REGS == target) - { - return MV_AHB_TO_MBUS_INTREG_WIN; - } - - for (winNum = 0; winNum < MAX_AHB_TO_MBUS_WINS ; winNum++) - { - if (winNum == MV_AHB_TO_MBUS_INTREG_WIN) - continue; - - if (mvAhbToMbusWinGet(winNum,&decWin) != MV_OK) - { - mvOsPrintf("mvAhbToMbusWinTargetGet: mvAhbToMbusWinGet fail\n"); - return 0xffffffff; - - } - - if (decWin.enable == MV_TRUE) - { - if (decWin.target == target) - { - return winNum; - } - - } - - } - - return 0xFFFFFFFF; - - -} - -/******************************************************************************* -* mvAhbToMbusWinAvailGet - Get First Available window number. -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -* -*******************************************************************************/ -MV_U32 mvAhbToMbusWinAvailGet(MV_VOID) -{ - MV_AHB_TO_MBUS_DEC_WIN decWin; - MV_U32 winNum; - - for (winNum = 0; winNum < MAX_AHB_TO_MBUS_WINS ; winNum++) - { - if (winNum == MV_AHB_TO_MBUS_INTREG_WIN) - continue; - - if (mvAhbToMbusWinGet(winNum,&decWin) != MV_OK) - { - mvOsPrintf("mvAhbToMbusWinTargetGet: mvAhbToMbusWinGet fail\n"); - return 0xffffffff; - - } - - if (decWin.enable == MV_FALSE) - { - return winNum; - } - - } - - return 0xFFFFFFFF; -} - - -/******************************************************************************* -* mvAhbToMbusWinEnable - Enable/disable a CPU address decode window -* -* DESCRIPTION: -* This function enable/disable a CPU address decode window. -* if parameter 'enable' == MV_TRUE the routine will enable the -* window, thus enabling CPU accesses (before enabling the window it is -* tested for overlapping). Otherwise, the window will be disabled. -* -* INPUT: -* winNum - Peripheral winNum enumerator. -* enable - Enable/disable parameter. -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_ERROR if protection window number was wrong, or the window -* overlapps other winNum window. -* -*******************************************************************************/ -MV_STATUS mvAhbToMbusWinEnable(MV_U32 winNum, MV_BOOL enable) -{ - - /* Parameter checking */ - if (winNum >= MAX_AHB_TO_MBUS_WINS) - { - mvOsPrintf("mvAhbToMbusWinEnable: ERR. Invalid winNum %d\n", winNum); - return MV_NOT_SUPPORTED; - } - - /* Internal registers bar can't be disable or enabled */ - if (winNum == MV_AHB_TO_MBUS_INTREG_WIN) - { - return (enable ? MV_OK : MV_ERROR); - } - - if (enable == MV_TRUE) - { - /* enable the window */ - MV_REG_BIT_SET(AHB_TO_MBUS_WIN_CTRL_REG(winNum), ATMWCR_WIN_ENABLE); - } - else - { /* Disable address decode winNum window */ - MV_REG_BIT_RESET(AHB_TO_MBUS_WIN_CTRL_REG(winNum), ATMWCR_WIN_ENABLE); - } - - return MV_OK; -} - - -/******************************************************************************* -* mvAhbToMbusWinRemap - Set CPU remap register for address windows. -* -* DESCRIPTION: -* After a CPU address hits one of PCI address decode windows there is an -* option to remap the address to a different one. For example, CPU -* executes a read from PCI winNum window address 0x1200.0000. This -* can be modified so the address on the PCI bus would be 0x1400.0000 -* Using the PCI address remap mechanism. -* -* INPUT: -* winNum - Peripheral winNum enumerator. Must be a PCI winNum. -* pAddrDecWin - CPU winNum 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 winNum is not a PCI one, MV_OK otherwise. -* -*******************************************************************************/ -MV_U32 mvAhbToMbusWinRemap(MV_U32 winNum, MV_ADDR_WIN *pAddrWin) -{ - MV_U32 baseAddr; - AHB_TO_MBUS_REMAP_REG_OFFS remapRegOffs; - - MV_U32 effectiveBaseAddress=0, - baseAddrValue=0,windowSizeValue=0; - - - /* Get registers offsets of given winNum */ - if (MV_NO_SUCH == ahbToMbusRemapRegOffsGet(winNum, &remapRegOffs)) - { - return 0xffffffff; - } - - /* 1) Set address remap low */ - baseAddr = pAddrWin->baseLow; - - /* Check base address aligment */ - /* - if (MV_IS_NOT_ALIGN(baseAddr, ATMWRLR_REMAP_LOW_ALIGNMENT)) - { - mvOsPrintf("mvAhbToMbusPciRemap: Warning. Target base 0x%x unaligned\n", - baseAddr); - return MV_ERROR; - } - */ - - /* BaseLow[31:16] => base register [31:16] */ - baseAddr = baseAddr & ATMWRLR_REMAP_LOW_MASK; - - MV_REG_WRITE(remapRegOffs.lowRegOffs, baseAddr); - - MV_REG_WRITE(remapRegOffs.highRegOffs, pAddrWin->baseHigh); - - - baseAddrValue = MV_REG_READ(AHB_TO_MBUS_WIN_BASE_REG(winNum)); - windowSizeValue = MV_REG_READ(AHB_TO_MBUS_WIN_CTRL_REG(winNum)); - - baseAddrValue &= ATMWBR_BASE_MASK; - windowSizeValue &=ATMWCR_WIN_SIZE_MASK; - - /* Start calculating the effective Base Address */ - effectiveBaseAddress = baseAddrValue ; - - /* The effective base address will be combined from the chopped (if any) - remap value (according to the size value and remap mechanism) and the - window's base address */ - effectiveBaseAddress |= (((windowSizeValue) | 0xffff) & pAddrWin->baseLow); - /* If the effectiveBaseAddress exceed the window boundaries return an - invalid value. */ - - if (effectiveBaseAddress > (baseAddrValue + (windowSizeValue | 0xffff))) - { - mvOsPrintf("mvAhbToMbusPciRemap: Error\n"); - return 0xffffffff; - } - - return effectiveBaseAddress; - - -} -/******************************************************************************* -* mvAhbToMbusWinTargetSwap - Swap AhbToMbus windows between targets -* -* DESCRIPTION: -* -* INPUT: -* target1 - CPU Interface target 1 -* target2 - CPU Interface target 2 -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if targets are illigal, or if one of the targets is not -* associated to a valid window . -* MV_OK otherwise. -* -*******************************************************************************/ - - -MV_STATUS mvAhbToMbusWinTargetSwap(MV_TARGET target1,MV_TARGET target2) -{ - MV_U32 winNum1,winNum2; - MV_AHB_TO_MBUS_DEC_WIN winDec1,winDec2,winDecTemp; - AHB_TO_MBUS_REMAP_REG_OFFS remapRegs1,remapRegs2; - MV_U32 remapBaseLow1=0,remapBaseLow2=0; - MV_U32 remapBaseHigh1=0,remapBaseHigh2=0; - - - /* Check parameters */ - if (target1 >= MAX_TARGETS) - { - mvOsPrintf("mvAhbToMbusWinTargetSwap: target %d is Illigal\n", target1); - return MV_ERROR; - } - - if (target2 >= MAX_TARGETS) - { - mvOsPrintf("mvAhbToMbusWinTargetSwap: target %d is Illigal\n", target1); - return MV_ERROR; - } - - - /* get window associated with this target */ - winNum1 = mvAhbToMbusWinTargetGet(target1); - - if (winNum1 == 0xffffffff) - { - mvOsPrintf("mvAhbToMbusWinTargetSwap: target %d has illigal win %d\n", - target1,winNum1); - return MV_ERROR; - - } - - /* get window associated with this target */ - winNum2 = mvAhbToMbusWinTargetGet(target2); - - if (winNum2 == 0xffffffff) - { - mvOsPrintf("mvAhbToMbusWinTargetSwap: target %d has illigal win %d\n", - target2,winNum2); - return MV_ERROR; - - } - - /* now Get original values of both Windows */ - if (MV_OK != mvAhbToMbusWinGet(winNum1,&winDec1)) - { - mvOsPrintf("mvAhbToMbusWinTargetSwap: mvAhbToMbusWinGet failed win %d\n", - winNum1); - return MV_ERROR; - - } - if (MV_OK != mvAhbToMbusWinGet(winNum2,&winDec2)) - { - mvOsPrintf("mvAhbToMbusWinTargetSwap: mvAhbToMbusWinGet failed win %d\n", - winNum2); - return MV_ERROR; - - } - - - /* disable both windows */ - if (MV_OK != mvAhbToMbusWinEnable(winNum1,MV_FALSE)) - { - mvOsPrintf("mvAhbToMbusWinTargetSwap: failed to enable window %d\n", - winNum1); - return MV_ERROR; - - } - if (MV_OK != mvAhbToMbusWinEnable(winNum2,MV_FALSE)) - { - mvOsPrintf("mvAhbToMbusWinTargetSwap: failed to enable windo %d\n", - winNum2); - return MV_ERROR; - - } - - - /* now swap targets */ - - /* first save winDec2 values */ - winDecTemp.addrWin.baseHigh = winDec2.addrWin.baseHigh; - winDecTemp.addrWin.baseLow = winDec2.addrWin.baseLow; - winDecTemp.addrWin.size = winDec2.addrWin.size; - winDecTemp.enable = winDec2.enable; - winDecTemp.target = winDec2.target; - - /* winDec2 = winDec1 */ - winDec2.addrWin.baseHigh = winDec1.addrWin.baseHigh; - winDec2.addrWin.baseLow = winDec1.addrWin.baseLow; - winDec2.addrWin.size = winDec1.addrWin.size; - winDec2.enable = winDec1.enable; - winDec2.target = winDec1.target; - - - /* winDec1 = winDecTemp */ - winDec1.addrWin.baseHigh = winDecTemp.addrWin.baseHigh; - winDec1.addrWin.baseLow = winDecTemp.addrWin.baseLow; - winDec1.addrWin.size = winDecTemp.addrWin.size; - winDec1.enable = winDecTemp.enable; - winDec1.target = winDecTemp.target; - - - /* now set the new values */ - - - mvAhbToMbusWinSet(winNum1,&winDec1); - mvAhbToMbusWinSet(winNum2,&winDec2); - - - - - - /* now we will treat the remap windows if exist */ - - - /* now check if one or both windows has a remap window - as well after the swap ! */ - - /* if a window had a remap value differnt than the base value - before the swap , then after the swap the remap value will be - equal to the base value unless both windows has a remap windows*/ - - /* first get old values */ - if (MV_NO_SUCH != ahbToMbusRemapRegOffsGet(winNum1,&remapRegs1)) - { - remapBaseLow1 = MV_REG_READ(remapRegs1.lowRegOffs); - remapBaseHigh1 = MV_REG_READ(remapRegs1.highRegOffs); - - } - if (MV_NO_SUCH != ahbToMbusRemapRegOffsGet(winNum2,&remapRegs2)) - { - remapBaseLow2 = MV_REG_READ(remapRegs2.lowRegOffs); - remapBaseHigh2 = MV_REG_READ(remapRegs2.highRegOffs); - - - } - - /* now do the swap */ - if (MV_NO_SUCH != ahbToMbusRemapRegOffsGet(winNum1,&remapRegs1)) - { - if (MV_NO_SUCH != ahbToMbusRemapRegOffsGet(winNum2,&remapRegs2)) - { - /* Two windows has a remap !!! so swap */ - - MV_REG_WRITE(remapRegs2.highRegOffs,remapBaseHigh1); - MV_REG_WRITE(remapRegs2.lowRegOffs,remapBaseLow1); - - MV_REG_WRITE(remapRegs1.highRegOffs,remapBaseHigh2); - MV_REG_WRITE(remapRegs1.lowRegOffs,remapBaseLow2); - - - - } - else - { - /* remap == base */ - MV_REG_WRITE(remapRegs1.highRegOffs,winDec1.addrWin.baseHigh); - MV_REG_WRITE(remapRegs1.lowRegOffs,winDec1.addrWin.baseLow); - - } - - } - else if (MV_NO_SUCH != ahbToMbusRemapRegOffsGet(winNum2,&remapRegs2)) - { - /* remap == base */ - MV_REG_WRITE(remapRegs2.highRegOffs,winDec2.addrWin.baseHigh); - MV_REG_WRITE(remapRegs2.lowRegOffs,winDec2.addrWin.baseLow); - - } - - - - return MV_OK; - - -} - - - -#if defined(MV_88F1181) - -/******************************************************************************* -* mvAhbToMbusXbarCtrlSet - Set The CPU master Xbar arbitration. -* -* DESCRIPTION: -* This function sets CPU Mbus Arbiter -* -* INPUT: -* pPizzaArbArray - A priority Structure describing 16 "pizza slices". At -* each clock cycle, the crossbar arbiter samples all -* requests and gives the bus to the next agent according -* to the "pizza". -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_ERROR if paramers to function invalid. -* -*******************************************************************************/ -MV_STATUS mvMbusArbSet(MV_MBUS_ARB_TARGET *pPizzaArbArray) -{ - MV_U32 sliceNum; - MV_U32 xbarCtrl = 0; - MV_MBUS_ARB_TARGET xbarTarget; - - /* 1) Set crossbar control low register */ - for (sliceNum = 0; sliceNum < MRLR_SLICE_NUM; sliceNum++) - { - xbarTarget = pPizzaArbArray[sliceNum]; - - /* sliceNum parameter check */ - if (xbarTarget > MAX_MBUS_ARB_TARGETS) - { - mvOsPrintf("mvAhbToMbusXbarCtrlSet: ERR. Can't set Target %d\n", - xbarTarget); - return MV_ERROR; - } - xbarCtrl |= (xbarTarget << MRLR_LOW_ARB_OFFS(sliceNum)); - } - /* Write to crossbar control low register */ - MV_REG_WRITE(MBUS_ARBITER_LOW_REG, xbarCtrl); - - xbarCtrl = 0; - - /* 2) Set crossbar control high register */ - for (sliceNum = MRLR_SLICE_NUM; - sliceNum < MRLR_SLICE_NUM+MRHR_SLICE_NUM; - sliceNum++) - { - - xbarTarget = pPizzaArbArray[sliceNum]; - - /* sliceNum parameter check */ - if (xbarTarget > MAX_MBUS_ARB_TARGETS) - { - mvOsPrintf("mvAhbToMbusXbarCtrlSet: ERR. Can't set Target %d\n", - xbarTarget); - return MV_ERROR; - } - xbarCtrl |= (xbarTarget << MRHR_HIGH_ARB_OFFS(sliceNum)); - } - /* Write to crossbar control high register */ - MV_REG_WRITE(MBUS_ARBITER_HIGH_REG, xbarCtrl); - - return MV_OK; -} - -/******************************************************************************* -* mvMbusArbCtrlSet - Set MBus Arbiter control register -* -* DESCRIPTION: -* -* INPUT: -* ctrl - pointer to MV_MBUS_ARB_CTRL register -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_ERROR if paramers to function invalid. -* -*******************************************************************************/ -MV_STATUS mvMbusArbCtrlSet(MV_MBUS_ARB_CTRL *ctrl) -{ - - if (ctrl->highPrio == MV_FALSE) - { - MV_REG_BIT_RESET(MBUS_ARBITER_CTRL_REG, MACR_ARB_ARM_TOP); - } - else - { - MV_REG_BIT_SET(MBUS_ARBITER_CTRL_REG, MACR_ARB_ARM_TOP); - } - - if (ctrl->fixedRoundRobin == MV_FALSE) - { - MV_REG_BIT_RESET(MBUS_ARBITER_CTRL_REG, MACR_ARB_TARGET_FIXED); - } - else - { - MV_REG_BIT_SET(MBUS_ARBITER_CTRL_REG, MACR_ARB_TARGET_FIXED); - } - - if (ctrl->starvEn == MV_FALSE) - { - MV_REG_BIT_RESET(MBUS_ARBITER_CTRL_REG, MACR_ARB_REQ_CTRL_EN); - } - else - { - MV_REG_BIT_SET(MBUS_ARBITER_CTRL_REG, MACR_ARB_REQ_CTRL_EN); - } - - return MV_OK; -} - -/******************************************************************************* -* mvMbusArbCtrlGet - Get MBus Arbiter control register -* -* DESCRIPTION: -* -* INPUT: -* ctrl - pointer to MV_MBUS_ARB_CTRL register -* -* OUTPUT: -* ctrl - pointer to MV_MBUS_ARB_CTRL register -* -* RETURN: -* MV_ERROR if paramers to function invalid. -* -*******************************************************************************/ -MV_STATUS mvMbusArbCtrlGet(MV_MBUS_ARB_CTRL *ctrl) -{ - - MV_U32 ctrlReg = MV_REG_READ(MBUS_ARBITER_CTRL_REG); - - if (ctrlReg & MACR_ARB_ARM_TOP) - { - ctrl->highPrio = MV_TRUE; - } - else - { - ctrl->highPrio = MV_FALSE; - } - - if (ctrlReg & MACR_ARB_TARGET_FIXED) - { - ctrl->fixedRoundRobin = MV_TRUE; - } - else - { - ctrl->fixedRoundRobin = MV_FALSE; - } - - if (ctrlReg & MACR_ARB_REQ_CTRL_EN) - { - ctrl->starvEn = MV_TRUE; - } - else - { - ctrl->starvEn = MV_FALSE; - } - - - return MV_OK; -} - -#endif /* #if defined(MV_88F1181) */ - - - -/******************************************************************************* -* ahbToMbusRemapRegOffsGet - Get CPU address remap register offsets -* -* DESCRIPTION: -* CPU to PCI address remap registers offsets are inconsecutive. -* This function returns PCI address remap registers offsets. -* -* INPUT: -* winNum - Address decode window number. See MV_U32 enumerator. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if winNum is not a PCI one. -* -*******************************************************************************/ -static MV_STATUS ahbToMbusRemapRegOffsGet(MV_U32 winNum, - AHB_TO_MBUS_REMAP_REG_OFFS *pRemapRegs) -{ - switch (winNum) - { - case 0: - case 1: - pRemapRegs->lowRegOffs = AHB_TO_MBUS_WIN_REMAP_LOW_REG(winNum); - pRemapRegs->highRegOffs = AHB_TO_MBUS_WIN_REMAP_HIGH_REG(winNum); - break; - case 2: - case 3: - if((mvCtrlModelGet() == MV_5281_DEV_ID) || - (mvCtrlModelGet() == MV_1281_DEV_ID) || - (mvCtrlModelGet() == MV_6183_DEV_ID) || - (mvCtrlModelGet() == MV_6183L_DEV_ID)) - { - pRemapRegs->lowRegOffs = AHB_TO_MBUS_WIN_REMAP_LOW_REG(winNum); - pRemapRegs->highRegOffs = AHB_TO_MBUS_WIN_REMAP_HIGH_REG(winNum); - break; - } - else - { - pRemapRegs->lowRegOffs = 0; - pRemapRegs->highRegOffs = 0; - - DB(mvOsPrintf("ahbToMbusRemapRegOffsGet: ERR. Invalid winNum %d\n", - winNum)); - return MV_NO_SUCH; - } - default: - { - pRemapRegs->lowRegOffs = 0; - pRemapRegs->highRegOffs = 0; - - DB(mvOsPrintf("ahbToMbusRemapRegOffsGet: ERR. Invalid winNum %d\n", - winNum)); - return MV_NO_SUCH; - } - } - - return MV_OK; -} - -/******************************************************************************* -* mvAhbToMbusAddDecShow - Print the AHB to MBus bridge address decode map. -* -* DESCRIPTION: -* This function print the CPU address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvAhbToMbusAddDecShow(MV_VOID) -{ - MV_AHB_TO_MBUS_DEC_WIN win; - MV_U32 winNum; - mvOsOutput( "\n" ); - mvOsOutput( "AHB To MBUS Bridge:\n" ); - mvOsOutput( "-------------------\n" ); - - for( winNum = 0; winNum < MAX_AHB_TO_MBUS_WINS; winNum++ ) - { - memset( &win, 0, sizeof(MV_AHB_TO_MBUS_DEC_WIN) ); - - mvOsOutput( "win%d - ", winNum ); - - if( mvAhbToMbusWinGet( winNum, &win ) == MV_OK ) - { - if( win.enable ) - { - mvOsOutput( "%s base %08x, ", - mvCtrlTargetNameGet(win.target), win.addrWin.baseLow ); - mvOsOutput( "...." ); - mvSizePrint( win.addrWin.size ); - - mvOsOutput( "\n" ); - - } - else - mvOsOutput( "disable\n" ); - } - } - -} - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvAhbToMbus.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvAhbToMbus.h deleted file mode 100644 index 1b352a1f6b..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvAhbToMbus.h +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __INCmvAhbToMbush -#define __INCmvAhbToMbush - -/* includes */ -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/sys/mvAhbToMbusRegs.h" -#include "ctrlEnv/mvCtrlEnvAddrDec.h" - -/* defines */ - -#if defined(MV_88F1181) -/* This enumerator defines the Marvell controller possible MBUS arbiter */ -/* target ports. It is used to define crossbar priority scheame (pizza) */ -typedef enum _mvMBusArbTargetId -{ - DRAM_MBUS_ARB_TARGET = 0, /* Port 0 -> DRAM interface */ - TWSI_MBUS_ARB_TARGET = 1, /* Port 1 -> TWSI */ - ARM_MBUS_ARB_TARGET = 2, /* Port 2 -> ARM */ - PEX1_MBUS_ARB_TARGET = 3, /* Port 3 -> PCI Express 1 */ - PEX0_MBUS_ARB_TARGET = 4, /* Port 4 -> PCI Express0 */ - MAX_MBUS_ARB_TARGETS -}MV_MBUS_ARB_TARGET; - -typedef struct _mvMBusArbCtrl -{ - MV_BOOL starvEn; - MV_BOOL highPrio; - MV_BOOL fixedRoundRobin; - -}MV_MBUS_ARB_CTRL; - -#endif /* #if defined(MV_88F1181) */ - -typedef struct _mvAhbtoMbusDecWin -{ - MV_TARGET target; - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -}MV_AHB_TO_MBUS_DEC_WIN; - -/* mvAhbToMbus.h API list */ - -MV_STATUS mvAhbToMbusInit(MV_VOID); -MV_STATUS mvAhbToMbusWinSet(MV_U32 winNum, MV_AHB_TO_MBUS_DEC_WIN *pAddrDecWin); -MV_STATUS mvAhbToMbusWinGet(MV_U32 winNum, MV_AHB_TO_MBUS_DEC_WIN *pAddrDecWin); -MV_STATUS mvAhbToMbusWinEnable(MV_U32 winNum,MV_BOOL enable); -MV_U32 mvAhbToMbusWinRemap(MV_U32 winNum, MV_ADDR_WIN *pAddrDecWin); -MV_U32 mvAhbToMbusWinTargetGet(MV_TARGET target); -MV_U32 mvAhbToMbusWinAvailGet(MV_VOID); -MV_STATUS mvAhbToMbusWinTargetSwap(MV_TARGET target1,MV_TARGET target2); - -#if defined(MV_88F1181) - -MV_STATUS mvMbusArbSet(MV_MBUS_ARB_TARGET *pPizzaArbArray); -MV_STATUS mvMbusArbCtrlSet(MV_MBUS_ARB_CTRL *ctrl); -MV_STATUS mvMbusArbCtrlGet(MV_MBUS_ARB_CTRL *ctrl); - -#endif /* #if defined(MV_88F1181) */ - - -MV_VOID mvAhbToMbusAddDecShow(MV_VOID); - - -#endif /* __INCmvAhbToMbush */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvAhbToMbusRegs.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvAhbToMbusRegs.h deleted file mode 100644 index 97dc631890..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvAhbToMbusRegs.h +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __INCmvAhbToMbusRegsh -#define __INCmvAhbToMbusRegsh - -/******************************/ -/* ARM Address Map Registers */ -/******************************/ - -#define MAX_AHB_TO_MBUS_WINS 9 -#define MV_AHB_TO_MBUS_INTREG_WIN 8 - - -#define AHB_TO_MBUS_WIN_CTRL_REG(winNum) (0x20000 + (winNum)*0x10) -#define AHB_TO_MBUS_WIN_BASE_REG(winNum) (0x20004 + (winNum)*0x10) -#define AHB_TO_MBUS_WIN_REMAP_LOW_REG(winNum) (0x20008 + (winNum)*0x10) -#define AHB_TO_MBUS_WIN_REMAP_HIGH_REG(winNum) (0x2000C + (winNum)*0x10) -#define AHB_TO_MBUS_WIN_INTEREG_REG 0x20080 - -/* Window Control Register */ -/* AHB_TO_MBUS_WIN_CTRL_REG (ATMWCR)*/ -#define ATMWCR_WIN_ENABLE BIT0 /* Window Enable */ - -#define ATMWCR_WIN_TARGET_OFFS 4 /* The target interface associated - with this window*/ -#define ATMWCR_WIN_TARGET_MASK (0xf << ATMWCR_WIN_TARGET_OFFS) - -#define ATMWCR_WIN_ATTR_OFFS 8 /* The target interface attributes - Associated with this window */ -#define ATMWCR_WIN_ATTR_MASK (0xff << ATMWCR_WIN_ATTR_OFFS) - - -/* -Used with the Base register to set the address window size and location -Must be programed from LSB to MSB as sequence of 1’s followed -by sequence of 0’s. The number of 1’s specifies the size of the window -in 64 KB granularity (e.g. a value of 0x00FF specifies 256 = 16 MB). - -NOTE: A value of 0x0 specifies 64KB size. -*/ -#define ATMWCR_WIN_SIZE_OFFS 16 /* Window Size */ -#define ATMWCR_WIN_SIZE_MASK (0xffff << ATMWCR_WIN_SIZE_OFFS) -#define ATMWCR_WIN_SIZE_ALIGNMENT 0x10000 - -/* Window Base Register */ -/* AHB_TO_MBUS_WIN_BASE_REG (ATMWBR) */ - -/* -Used with the size field to set the address window size and location. -Corresponds to transaction address[31:16] -*/ -#define ATMWBR_BASE_OFFS 16 /* Base Address */ -#define ATMWBR_BASE_MASK (0xffff << ATMWBR_BASE_OFFS) -#define ATMWBR_BASE_ALIGNMENT 0x10000 - -/* Window Remap Low Register */ -/* AHB_TO_MBUS_WIN_REMAP_LOW_REG (ATMWRLR) */ - -/* -Used with the size field to specifies address bits[31:0] to be driven to -the target interface.: -target_addr[31:16] = (addr[31:16] & size[15:0]) | (remap[31:16] & ~size[15:0]) -*/ -#define ATMWRLR_REMAP_LOW_OFFS 16 /* Remap Address */ -#define ATMWRLR_REMAP_LOW_MASK (0xffff << ATMWRLR_REMAP_LOW_OFFS) -#define ATMWRLR_REMAP_LOW_ALIGNMENT 0x10000 - -/* Window Remap High Register */ -/* AHB_TO_MBUS_WIN_REMAP_HIGH_REG (ATMWRHR) */ - -/* -Specifies address bits[63:32] to be driven to the target interface. -target_addr[63:32] = (RemapHigh[31:0] -*/ -#define ATMWRHR_REMAP_HIGH_OFFS 0 /* Remap Address */ -#define ATMWRHR_REMAP_HIGH_MASK (0xffffffff << ATMWRHR_REMAP_HIGH_OFFS) - - -#endif /* __INCmvAhbToMbusRegsh */ - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvCpuIf.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvCpuIf.c deleted file mode 100644 index 872dc6e9d8..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvCpuIf.c +++ /dev/null @@ -1,1036 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -/* includes */ -#include "ctrlEnv/sys/mvCpuIf.h" -#include "ctrlEnv/sys/mvAhbToMbusRegs.h" -#include "cpu/mvCpu.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "mvSysHwConfig.h" -#include "mvSysDram.h" - -/*#define MV_DEBUG*/ -/* defines */ - -#ifdef MV_DEBUG - #define DB(x) x -#else - #define DB(x) -#endif - -/* locals */ -/* static functions */ -static MV_BOOL cpuTargetWinOverlap(MV_TARGET target, MV_ADDR_WIN *pAddrWin); - -MV_TARGET * sampleAtResetTargetArray; -MV_TARGET sampleAtResetTargetArrayP[] = BOOT_TARGETS_NAME_ARRAY; -MV_TARGET sampleAtResetTargetArray6180P[] = BOOT_TARGETS_NAME_ARRAY_6180; -/******************************************************************************* -* 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) - 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 */ - 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; - } - - 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; - - -} - - -/******************************************************************************* -* mvCpuIfTargetWinSet - Set CPU-to-peripheral target address window -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI0_MEM0) -* address window, also known as address decode window. -* A new address decode window is set for specified target address window. -* If address decode window parameter structure enables the window, -* the routine will also enable the target window, allowing CPU to access -* the target window. -* -* INPUT: -* target - Peripheral target enumerator. -* pAddrDecWin - CPU target window data structure. -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_OK if CPU target window was set correctly, MV_ERROR in case of -* address window overlapps with other active CPU target window or -* trying to assign 36bit base address while CPU does not support that. -* The function returns MV_NOT_SUPPORTED, if the target is unsupported. -* -*******************************************************************************/ -MV_STATUS mvCpuIfTargetWinSet(MV_TARGET target, MV_CPU_DEC_WIN *pAddrDecWin) -{ - MV_AHB_TO_MBUS_DEC_WIN decWin; - MV_U32 existingWinNum; - MV_DRAM_DEC_WIN addrDecWin; - - target = MV_CHANGE_BOOT_CS(target); - - /* Check parameters */ - if (target >= MAX_TARGETS) - { - mvOsPrintf("mvCpuIfTargetWinSet: target %d is Illigal\n", target); - return MV_ERROR; - } - - /* 2) Check if the requested window overlaps with current windows */ - if (MV_TRUE == cpuTargetWinOverlap(target, &pAddrDecWin->addrWin)) - { - mvOsPrintf("mvCpuIfTargetWinSet: ERR. Target %d overlap\n", target); - return MV_BAD_PARAM; - } - - if (MV_TARGET_IS_DRAM(target)) - { - /* copy relevant data to MV_DRAM_DEC_WIN structure */ - addrDecWin.addrWin.baseHigh = pAddrDecWin->addrWin.baseHigh; - addrDecWin.addrWin.baseLow = pAddrDecWin->addrWin.baseLow; - addrDecWin.addrWin.size = pAddrDecWin->addrWin.size; - addrDecWin.enable = pAddrDecWin->enable; - - - if (mvDramIfWinSet(target,&addrDecWin) != MV_OK); - { - mvOsPrintf("mvCpuIfTargetWinSet: mvDramIfWinSet Failed\n"); - return MV_ERROR; - } - - } - else - { - /* copy relevant data to MV_AHB_TO_MBUS_DEC_WIN structure */ - decWin.addrWin.baseLow = pAddrDecWin->addrWin.baseLow; - decWin.addrWin.baseHigh = pAddrDecWin->addrWin.baseHigh; - decWin.addrWin.size = pAddrDecWin->addrWin.size; - decWin.enable = pAddrDecWin->enable; - decWin.target = target; - - existingWinNum = mvAhbToMbusWinTargetGet(target); - - /* check if there is already another Window configured - for this target */ - if ((existingWinNum < MAX_AHB_TO_MBUS_WINS )&& - (existingWinNum != pAddrDecWin->winNum)) - { - /* if we want to enable the new winow number - passed by the user , then the old one should - be disabled */ - if (MV_TRUE == pAddrDecWin->enable) - { - /* be sure it is disabled */ - mvAhbToMbusWinEnable(existingWinNum , MV_FALSE); - } - } - - if (mvAhbToMbusWinSet(pAddrDecWin->winNum,&decWin) != MV_OK) - { - mvOsPrintf("mvCpuIfTargetWinSet: mvAhbToMbusWinSet Failed\n"); - return MV_ERROR; - } - - } - - return MV_OK; -} - -/******************************************************************************* -* mvCpuIfTargetWinGet - Get CPU-to-peripheral target address window -* -* DESCRIPTION: -* Get the CPU peripheral target address window. -* -* INPUT: -* target - Peripheral target enumerator -* -* OUTPUT: -* pAddrDecWin - CPU target window information data structure. -* -* RETURN: -* MV_OK if target exist, MV_ERROR otherwise. -* -*******************************************************************************/ -MV_STATUS mvCpuIfTargetWinGet(MV_TARGET target, MV_CPU_DEC_WIN *pAddrDecWin) -{ - - MV_U32 winNum=0xffffffff; - MV_AHB_TO_MBUS_DEC_WIN decWin; - MV_DRAM_DEC_WIN addrDecWin; - - target = MV_CHANGE_BOOT_CS(target); - - /* Check parameters */ - if (target >= MAX_TARGETS) - { - mvOsPrintf("mvCpuIfTargetWinGet: target %d is Illigal\n", target); - return MV_ERROR; - } - - if (MV_TARGET_IS_DRAM(target)) - { - if (mvDramIfWinGet(target,&addrDecWin) != MV_OK) - { - mvOsPrintf("mvCpuIfTargetWinGet: Failed to get window target %d\n", - target); - return MV_ERROR; - } - - /* copy relevant data to MV_CPU_DEC_WIN structure */ - pAddrDecWin->addrWin.baseLow = addrDecWin.addrWin.baseLow; - pAddrDecWin->addrWin.baseHigh = addrDecWin.addrWin.baseHigh; - pAddrDecWin->addrWin.size = addrDecWin.addrWin.size; - pAddrDecWin->enable = addrDecWin.enable; - pAddrDecWin->winNum = 0xffffffff; - - } - else - { - /* get the Window number associated with this target */ - - winNum = mvAhbToMbusWinTargetGet(target); - if (winNum >= MAX_AHB_TO_MBUS_WINS) - { - return MV_NO_SUCH; - - } - - if (mvAhbToMbusWinGet(winNum , &decWin) != MV_OK) - { - mvOsPrintf("%s: mvAhbToMbusWinGet Failed at winNum = %d\n", - __FUNCTION__, winNum); - return MV_ERROR; - - } - - /* copy relevant data to MV_CPU_DEC_WIN structure */ - pAddrDecWin->addrWin.baseLow = decWin.addrWin.baseLow; - pAddrDecWin->addrWin.baseHigh = decWin.addrWin.baseHigh; - pAddrDecWin->addrWin.size = decWin.addrWin.size; - pAddrDecWin->enable = decWin.enable; - pAddrDecWin->winNum = winNum; - - } - - - - - return MV_OK; -} - - -/******************************************************************************* -* mvCpuIfTargetWinEnable - Enable/disable a CPU address decode window -* -* DESCRIPTION: -* This function enable/disable a CPU address decode window. -* if parameter 'enable' == MV_TRUE the routine will enable the -* window, thus enabling CPU accesses (before enabling the window it is -* tested for overlapping). Otherwise, the window will be disabled. -* -* INPUT: -* target - Peripheral target enumerator. -* enable - Enable/disable parameter. -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_ERROR if protection window number was wrong, or the window -* overlapps other target window. -* -*******************************************************************************/ -MV_STATUS mvCpuIfTargetWinEnable(MV_TARGET target,MV_BOOL enable) -{ - MV_U32 winNum, temp; - MV_CPU_DEC_WIN addrDecWin; - - target = MV_CHANGE_BOOT_CS(target); - - /* Check parameters */ - if (target >= MAX_TARGETS) - { - mvOsPrintf("mvCpuIfTargetWinEnable: target %d is Illigal\n", target); - return MV_ERROR; - } - - /* get the window and check if it exist */ - temp = mvCpuIfTargetWinGet(target, &addrDecWin); - if (MV_NO_SUCH == temp) - { - return (enable? MV_ERROR: MV_OK); - } - else if( MV_OK != temp) - { - mvOsPrintf("%s: ERR. Getting target %d failed.\n",__FUNCTION__, target); - return MV_ERROR; - } - - - /* check overlap */ - - if (MV_TRUE == enable) - { - if (MV_TRUE == cpuTargetWinOverlap(target, &addrDecWin.addrWin)) - { - DB(mvOsPrintf("%s: ERR. Target %d overlap\n",__FUNCTION__, target)); - return MV_ERROR; - } - - } - - - if (MV_TARGET_IS_DRAM(target)) - { - if (mvDramIfWinEnable(target , enable) != MV_OK) - { - mvOsPrintf("mvCpuIfTargetWinGet: mvDramIfWinEnable Failed at \n"); - return MV_ERROR; - - } - - } - else - { - /* get the Window number associated with this target */ - - winNum = mvAhbToMbusWinTargetGet(target); - - if (winNum >= MAX_AHB_TO_MBUS_WINS) - { - return (enable? MV_ERROR: MV_OK); - } - - if (mvAhbToMbusWinEnable(winNum , enable) != MV_OK) - { - mvOsPrintf("mvCpuIfTargetWinGet: Failed to enable window = %d\n", - winNum); - return MV_ERROR; - - } - - } - - return MV_OK; -} - - -/******************************************************************************* -* mvCpuIfTargetWinSizeGet - Get CPU target address window size -* -* DESCRIPTION: -* Get the size of CPU-to-peripheral target window. -* -* INPUT: -* target - Peripheral target enumerator -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit size. Function also returns '0' if window is closed. -* Function returns 0xFFFFFFFF in case of an error. -* -*******************************************************************************/ -MV_U32 mvCpuIfTargetWinSizeGet(MV_TARGET target) -{ - MV_CPU_DEC_WIN addrDecWin; - - target = MV_CHANGE_BOOT_CS(target); - - /* Check parameters */ - if (target >= MAX_TARGETS) - { - mvOsPrintf("mvCpuIfTargetWinSizeGet: target %d is Illigal\n", target); - return 0; - } - - /* Get the winNum window */ - if (MV_OK != mvCpuIfTargetWinGet(target, &addrDecWin)) - { - mvOsPrintf("mvCpuIfTargetWinSizeGet:ERR. Getting target %d failed.\n", - target); - return 0; - } - - /* Check if window is enabled */ - if (addrDecWin.enable == MV_TRUE) - { - return (addrDecWin.addrWin.size); - } - else - { - return 0; /* Window disabled. return 0 */ - } -} - -/******************************************************************************* -* mvCpuIfTargetWinBaseLowGet - Get CPU target address window base low -* -* DESCRIPTION: -* CPU-to-peripheral target address window base is constructed of -* two parts: Low and high. -* This function gets the CPU peripheral target low base address. -* -* INPUT: -* target - Peripheral target enumerator -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit low base address. -* -*******************************************************************************/ -MV_U32 mvCpuIfTargetWinBaseLowGet(MV_TARGET target) -{ - MV_CPU_DEC_WIN addrDecWin; - - target = MV_CHANGE_BOOT_CS(target); - - /* Check parameters */ - if (target >= MAX_TARGETS) - { - mvOsPrintf("mvCpuIfTargetWinBaseLowGet: target %d is Illigal\n", target); - return 0xffffffff; - } - - /* Get the target window */ - if (MV_OK != mvCpuIfTargetWinGet(target, &addrDecWin)) - { - mvOsPrintf("mvCpuIfTargetWinBaseLowGet:ERR. Getting target %d failed.\n", - target); - return 0xffffffff; - } - - if (MV_FALSE == addrDecWin.enable) - { - return 0xffffffff; - } - return (addrDecWin.addrWin.baseLow); -} - -/******************************************************************************* -* mvCpuIfTargetWinBaseHighGet - Get CPU target address window base high -* -* DESCRIPTION: -* CPU-to-peripheral target address window base is constructed of -* two parts: Low and high. -* This function gets the CPU peripheral target high base address. -* -* INPUT: -* target - Peripheral target enumerator -* -* OUTPUT: -* None. -* -* RETURN: -* 32bit high base address. -* -*******************************************************************************/ -MV_U32 mvCpuIfTargetWinBaseHighGet(MV_TARGET target) -{ - MV_CPU_DEC_WIN addrDecWin; - - target = MV_CHANGE_BOOT_CS(target); - - /* Check parameters */ - if (target >= MAX_TARGETS) - { - mvOsPrintf("mvCpuIfTargetWinBaseLowGet: target %d is Illigal\n", target); - return 0xffffffff; - } - - /* Get the target window */ - if (MV_OK != mvCpuIfTargetWinGet(target, &addrDecWin)) - { - mvOsPrintf("mvCpuIfTargetWinBaseHighGet:ERR. Getting target %d failed.\n", - target); - return 0xffffffff; - } - - if (MV_FALSE == addrDecWin.enable) - { - return 0; - } - - return (addrDecWin.addrWin.baseHigh); -} - -#if defined(MV_INCLUDE_PEX) -/******************************************************************************* -* mvCpuIfPexRemap - Set CPU remap register for address windows. -* -* DESCRIPTION: -* -* INPUT: -* pexTarget - Peripheral target enumerator. Must be a PEX 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 PEX one, MV_OK otherwise. -* -*******************************************************************************/ -MV_U32 mvCpuIfPexRemap(MV_TARGET pexTarget, MV_ADDR_WIN *pAddrDecWin) -{ - MV_U32 winNum; - - /* Check parameters */ - - if (mvCtrlPexMaxIfGet() > 1) - { - if ((!MV_TARGET_IS_PEX1(pexTarget))&&(!MV_TARGET_IS_PEX0(pexTarget))) - { - mvOsPrintf("mvCpuIfPexRemap: target %d is Illigal\n",pexTarget); - return 0xffffffff; - } - - } - else - { - if (!MV_TARGET_IS_PEX0(pexTarget)) - { - mvOsPrintf("mvCpuIfPexRemap: target %d is Illigal\n",pexTarget); - return 0xffffffff; - } - - } - - /* get the Window number associated with this target */ - winNum = mvAhbToMbusWinTargetGet(pexTarget); - - if (winNum >= MAX_AHB_TO_MBUS_WINS) - { - mvOsPrintf("mvCpuIfPexRemap: mvAhbToMbusWinTargetGet Failed\n"); - return 0xffffffff; - - } - - return mvAhbToMbusWinRemap(winNum , pAddrDecWin); -} - -#endif - -#if defined(MV_INCLUDE_PCI) -/******************************************************************************* -* 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 Illigal\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); -} -#endif /* MV_INCLUDE_PCI */ - - -/******************************************************************************* -* 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; -} - - - -/******************************************************************************* -* mvCpuIfTargetOfBaseAddressGet - Get the target according to base address -* -* DESCRIPTION: -* -* INPUT: -* baseAddress - base address to be checked -* -* OUTPUT: -* None. -* -* RETURN: -* the target number that baseAddress belongs to or MAX_TARGETS is not -* found -* -*******************************************************************************/ - -MV_TARGET mvCpuIfTargetOfBaseAddressGet(MV_U32 baseAddress) -{ - MV_CPU_DEC_WIN win; - MV_U32 target; - - for( target = 0; target < MAX_TARGETS; target++ ) - { - if( mvCpuIfTargetWinGet( target, &win ) == MV_OK ) - { - if( win.enable ) - { - if ((baseAddress >= win.addrWin.baseLow) && - (baseAddress < win.addrWin.baseLow + win.addrWin.size)) break; - } - } - else return MAX_TARGETS; - - } - - return target; -} -/******************************************************************************* -* cpuTargetWinOverlap - Detect CPU address decode windows overlapping -* -* DESCRIPTION: -* An unpredicted behaviur is expected in case CPU address decode -* windows overlapps. -* This function detects CPU address decode windows overlapping of a -* specified target. The function does not check the target itself for -* overlapping. The function also skipps disabled address decode windows. -* -* INPUT: -* target - Peripheral target enumerator. -* pAddrDecWin - An address decode window struct. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlaps current address -* decode map, MV_FALSE otherwise. -* -*******************************************************************************/ -static MV_BOOL cpuTargetWinOverlap(MV_TARGET target, MV_ADDR_WIN *pAddrWin) -{ - MV_U32 targetNum; - MV_CPU_DEC_WIN addrDecWin; - MV_STATUS status; - - - for(targetNum = 0; targetNum < MAX_TARGETS; targetNum++) - { -#if defined(MV_RUN_FROM_FLASH) - if(MV_TARGET_IS_AS_BOOT(target)) - { - if (MV_CHANGE_BOOT_CS(targetNum) == target) - continue; - } -#endif /* MV_RUN_FROM_FLASH */ - - /* don't check our target or illegal targets */ - if (targetNum == target) - { - continue; - } - - /* Get window parameters */ - status = mvCpuIfTargetWinGet(targetNum, &addrDecWin); - if(MV_NO_SUCH == status) - { - continue; - } - if(MV_OK != status) - { - DB(mvOsPrintf("cpuTargetWinOverlap: ERR. TargetWinGet failed\n")); - return MV_TRUE; - } - - /* Do not check disabled windows */ - if (MV_FALSE == addrDecWin.enable) - { - continue; - } - - if(MV_TRUE == ctrlWinOverlapTest(pAddrWin, &addrDecWin.addrWin)) - { - DB(mvOsPrintf( - "cpuTargetWinOverlap: Required target %d overlap current %d\n", - target, targetNum)); - return MV_TRUE; - } - } - - return MV_FALSE; - -} - -/******************************************************************************* -* mvCpuIfAddDecShow - Print the CPU address decode map. -* -* DESCRIPTION: -* This function print the CPU address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvCpuIfAddDecShow(MV_VOID) -{ - MV_CPU_DEC_WIN win; - MV_U32 target; - mvOsOutput( "\n" ); - mvOsOutput( "CPU Interface\n" ); - mvOsOutput( "-------------\n" ); - - for( target = 0; target < MAX_TARGETS; target++ ) - { - - memset( &win, 0, sizeof(MV_CPU_DEC_WIN) ); - - mvOsOutput( "%s ",mvCtrlTargetNameGet(target)); - mvOsOutput( "...." ); - - if( mvCpuIfTargetWinGet( target, &win ) == MV_OK ) - { - if( win.enable ) - { - mvOsOutput( "base %08x, ", win.addrWin.baseLow ); - mvSizePrint( win.addrWin.size ); - mvOsOutput( "\n" ); - - } - else - mvOsOutput( "disable\n" ); - } - else if( mvCpuIfTargetWinGet( target, &win ) == MV_NO_SUCH ) - { - mvOsOutput( "no such\n" ); - } - } -} - -/******************************************************************************* -* mvCpuIfEnablePex - Enable PCI Express. -* -* DESCRIPTION: -* This function Enable PCI Express. -* -* INPUT: -* pexIf - PEX interface number. -* pexType - MV_PEX_ROOT_COMPLEX - root complex device -* MV_PEX_END_POINT - end point device -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -#if defined(MV_INCLUDE_PEX) -MV_VOID mvCpuIfEnablePex(MV_U32 pexIf, MV_PEX_TYPE pexType) -{ - /* Set pex mode incase S@R not exist */ - if( pexType == MV_PEX_END_POINT) - { - MV_REG_BIT_RESET(PEX_CTRL_REG(pexIf),PXCR_DEV_TYPE_CTRL_MASK); - /* Change pex mode in capability reg */ - MV_REG_BIT_RESET(PEX_CFG_DIRECT_ACCESS(pexIf,PEX_CAPABILITY_REG), BIT22); - MV_REG_BIT_SET(PEX_CFG_DIRECT_ACCESS(pexIf,PEX_CAPABILITY_REG), BIT20); - - } - else - { - MV_REG_BIT_SET(PEX_CTRL_REG(pexIf),PXCR_DEV_TYPE_CTRL_MASK); - } - - /* CPU config register Pex enable */ - MV_REG_BIT_SET(CPU_CTRL_STAT_REG,CCSR_PCI_ACCESS_MASK); -} -#endif - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvCpuIf.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvCpuIf.h deleted file mode 100644 index 224ed07f59..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvCpuIf.h +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __INCmvCpuIfh -#define __INCmvCpuIfh - -/* includes */ -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/sys/mvCpuIfRegs.h" -#include "ctrlEnv/sys/mvAhbToMbus.h" -#include "ddr2/mvDramIf.h" -#include "ctrlEnv/sys/mvSysDram.h" -#if defined(MV_INCLUDE_PEX) -#include "pex/mvPex.h" -#endif - -/* defines */ - -/* typedefs */ -/* This structure describes CPU interface address decode window */ -typedef struct _mvCpuIfDecWin -{ - MV_ADDR_WIN addrWin; /* An address window*/ - MV_U32 winNum; /* Window Number in the AHB To Mbus bridge */ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -}MV_CPU_DEC_WIN; - - - -/* mvCpuIfLib.h API list */ - -/* mvCpuIfLib.h API list */ - -MV_STATUS mvCpuIfInit(MV_CPU_DEC_WIN *cpuAddrWinMap); -MV_STATUS mvCpuIfTargetWinSet(MV_TARGET target, MV_CPU_DEC_WIN *pAddrDecWin); -MV_STATUS mvCpuIfTargetWinGet(MV_TARGET target, MV_CPU_DEC_WIN *pAddrDecWin); -MV_STATUS mvCpuIfTargetWinEnable(MV_TARGET target,MV_BOOL enable); -MV_U32 mvCpuIfTargetWinSizeGet(MV_TARGET target); -MV_U32 mvCpuIfTargetWinBaseLowGet(MV_TARGET target); -MV_U32 mvCpuIfTargetWinBaseHighGet(MV_TARGET target); -MV_TARGET mvCpuIfTargetOfBaseAddressGet(MV_U32 baseAddress); -#if defined(MV_INCLUDE_PEX) -MV_U32 mvCpuIfPexRemap(MV_TARGET pexTarget, MV_ADDR_WIN *pAddrDecWin); -MV_VOID mvCpuIfEnablePex(MV_U32 pexIf, MV_PEX_TYPE pexType); -#endif -#if defined(MV_INCLUDE_PCI) -MV_U32 mvCpuIfPciRemap(MV_TARGET pciTarget, MV_ADDR_WIN *pAddrDecWin); -#endif -MV_U32 mvCpuIfPciIfRemap(MV_TARGET pciTarget, MV_ADDR_WIN *pAddrDecWin); - -MV_VOID mvCpuIfAddDecShow(MV_VOID); - -#if defined(MV88F6281) -MV_STATUS mvCpuIfBridgeReorderWAInit(void); -#endif - -#endif /* __INCmvCpuIfh */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvCpuIfRegs.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvCpuIfRegs.h deleted file mode 100644 index 8cfeee2db0..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvCpuIfRegs.h +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __INCmvCpuIfRegsh -#define __INCmvCpuIfRegsh - -/****************************************/ -/* ARM Control and Status Registers Map */ -/****************************************/ - -#define CPU_CONFIG_REG 0x20100 -#define CPU_CTRL_STAT_REG 0x20104 -#define CPU_RSTOUTN_MASK_REG 0x20108 -#define CPU_SYS_SOFT_RST_REG 0x2010C -#define CPU_AHB_MBUS_CAUSE_INT_REG 0x20110 -#define CPU_AHB_MBUS_MASK_INT_REG 0x20114 -#define CPU_FTDLL_CONFIG_REG 0x20120 -#define CPU_L2_CONFIG_REG 0x20128 - - - -/* ARM Configuration register */ -/* CPU_CONFIG_REG (CCR) */ - - -/* Reset vector location */ -#define CCR_VEC_INIT_LOC_OFFS 1 -#define CCR_VEC_INIT_LOC_MASK BIT1 -/* reset at 0x00000000 */ -#define CCR_VEC_INIT_LOC_0000 (0 << CCR_VEC_INIT_LOC_OFFS) -/* reset at 0xFFFF0000 */ -#define CCR_VEC_INIT_LOC_FF00 (1 << CCR_VEC_INIT_LOC_OFFS) - - -#define CCR_AHB_ERROR_PROP_OFFS 2 -#define CCR_AHB_ERROR_PROP_MASK BIT2 -/* Erros are not propogated to AHB */ -#define CCR_AHB_ERROR_PROP_NO_INDICATE (0 << CCR_AHB_ERROR_PROP_OFFS) -/* Erros are propogated to AHB */ -#define CCR_AHB_ERROR_PROP_INDICATE (1 << CCR_AHB_ERROR_PROP_OFFS) - - -#define CCR_ENDIAN_INIT_OFFS 3 -#define CCR_ENDIAN_INIT_MASK BIT3 -#define CCR_ENDIAN_INIT_LITTLE (0 << CCR_ENDIAN_INIT_OFFS) -#define CCR_ENDIAN_INIT_BIG (1 << CCR_ENDIAN_INIT_OFFS) - - -#define CCR_INCR_EN_OFFS 4 -#define CCR_INCR_EN_MASK BIT4 -#define CCR_INCR_EN BIT4 - - -#define CCR_NCB_BLOCKING_OFFS 5 -#define CCR_NCB_BLOCKING_MASK (1 << CCR_NCB_BLOCKING_OFFS) -#define CCR_NCB_BLOCKING_NON (0 << CCR_NCB_BLOCKING_OFFS) -#define CCR_NCB_BLOCKING_EN (1 << CCR_NCB_BLOCKING_OFFS) - -#define CCR_CPU_2_MBUSL_TICK_DRV_OFFS 8 -#define CCR_CPU_2_MBUSL_TICK_DRV_MASK (0xF << CCR_CPU_2_MBUSL_TICK_DRV_OFFS) -#define CCR_CPU_2_MBUSL_TICK_SMPL_OFFS 12 -#define CCR_CPU_2_MBUSL_TICK_SMPL_MASK (0xF << CCR_CPU_2_MBUSL_TICK_SMPL_OFFS) -#define CCR_ICACH_PREF_BUF_ENABLE BIT16 -#define CCR_DCACH_PREF_BUF_ENABLE BIT17 - -/* Ratio options for CPU to DDR for 6281/6192/6190 */ -#define CPU_2_DDR_CLK_1x3 4 -#define CPU_2_DDR_CLK_1x4 6 - -/* Ratio options for CPU to DDR for 6281 only */ -#define CPU_2_DDR_CLK_2x9 7 -#define CPU_2_DDR_CLK_1x5 8 -#define CPU_2_DDR_CLK_1x6 9 - -/* Ratio options for CPU to DDR for 6180 only */ -#define CPU_2_DDR_CLK_1x3_1 0x5 -#define CPU_2_DDR_CLK_1x4_1 0x6 - -/* Default values for CPU to Mbus-L DDR Interface Tick Driver and */ -/* CPU to Mbus-L Tick Sample fields in CPU config register */ - -#define TICK_DRV_1x1 0 -#define TICK_DRV_1x2 0 -#define TICK_DRV_1x3 1 -#define TICK_DRV_1x4 2 -#define TICK_SMPL_1x1 0 -#define TICK_SMPL_1x2 1 -#define TICK_SMPL_1x3 0 -#define TICK_SMPL_1x4 0 - -#define CPU_2_MBUSL_DDR_CLK_1x2 \ - ((TICK_DRV_1x2 << CCR_CPU_2_MBUSL_TICK_DRV_OFFS) | \ - (TICK_SMPL_1x2 << CCR_CPU_2_MBUSL_TICK_SMPL_OFFS)) -#define CPU_2_MBUSL_DDR_CLK_1x3 \ - ((TICK_DRV_1x3 << CCR_CPU_2_MBUSL_TICK_DRV_OFFS) | \ - (TICK_SMPL_1x3 << CCR_CPU_2_MBUSL_TICK_SMPL_OFFS)) -#define CPU_2_MBUSL_DDR_CLK_1x4 \ - ((TICK_DRV_1x4 << CCR_CPU_2_MBUSL_TICK_DRV_OFFS) | \ - (TICK_SMPL_1x4 << CCR_CPU_2_MBUSL_TICK_SMPL_OFFS)) - -/* ARM Control and Status register */ -/* CPU_CTRL_STAT_REG (CCSR) */ - - -/* -This is used to block PCI express\PCI from access Socrates/Feroceon GP -while ARM boot is still in progress -*/ - -#define CCSR_PCI_ACCESS_OFFS 0 -#define CCSR_PCI_ACCESS_MASK BIT0 -#define CCSR_PCI_ACCESS_ENABLE (0 << CCSR_PCI_ACCESS_OFFS) -#define CCSR_PCI_ACCESS_DISBALE (1 << CCSR_PCI_ACCESS_OFFS) - -#define CCSR_ARM_RESET BIT1 -#define CCSR_SELF_INT BIT2 -#define CCSR_BIG_ENDIAN BIT15 - - -/* RSTOUTn Mask Register */ -/* CPU_RSTOUTN_MASK_REG (CRMR) */ - -#define CRMR_PEX_RST_OUT_OFFS 0 -#define CRMR_PEX_RST_OUT_MASK BIT0 -#define CRMR_PEX_RST_OUT_ENABLE (1 << CRMR_PEX_RST_OUT_OFFS) -#define CRMR_PEX_RST_OUT_DISABLE (0 << CRMR_PEX_RST_OUT_OFFS) - -#define CRMR_WD_RST_OUT_OFFS 1 -#define CRMR_WD_RST_OUT_MASK BIT1 -#define CRMR_WD_RST_OUT_ENABLE (1 << CRMR_WD_RST_OUT_OFFS) -#define CRMR_WD_RST_OUT_DISBALE (0 << CRMR_WD_RST_OUT_OFFS) - -#define CRMR_SOFT_RST_OUT_OFFS 2 -#define CRMR_SOFT_RST_OUT_MASK BIT2 -#define CRMR_SOFT_RST_OUT_ENABLE (1 << CRMR_SOFT_RST_OUT_OFFS) -#define CRMR_SOFT_RST_OUT_DISBALE (0 << CRMR_SOFT_RST_OUT_OFFS) - -/* System Software Reset Register */ -/* CPU_SYS_SOFT_RST_REG (CSSRR) */ - -#define CSSRR_SYSTEM_SOFT_RST BIT0 - -/* AHB to Mbus Bridge Interrupt Cause Register*/ -/* CPU_AHB_MBUS_CAUSE_INT_REG (CAMCIR) */ - -#define CAMCIR_ARM_SELF_INT BIT0 -#define CAMCIR_ARM_TIMER0_INT_REQ BIT1 -#define CAMCIR_ARM_TIMER1_INT_REQ BIT2 -#define CAMCIR_ARM_WD_TIMER_INT_REQ BIT3 - - -/* AHB to Mbus Bridge Interrupt Mask Register*/ -/* CPU_AHB_MBUS_MASK_INT_REG (CAMMIR) */ - -#define CAMCIR_ARM_SELF_INT_OFFS 0 -#define CAMCIR_ARM_SELF_INT_MASK BIT0 -#define CAMCIR_ARM_SELF_INT_EN (1 << CAMCIR_ARM_SELF_INT_OFFS) -#define CAMCIR_ARM_SELF_INT_DIS (0 << CAMCIR_ARM_SELF_INT_OFFS) - - -#define CAMCIR_ARM_TIMER0_INT_REQ_OFFS 1 -#define CAMCIR_ARM_TIMER0_INT_REQ_MASK BIT1 -#define CAMCIR_ARM_TIMER0_INT_REQ_EN (1 << CAMCIR_ARM_TIMER0_INT_REQ_OFFS) -#define CAMCIR_ARM_TIMER0_INT_REQ_DIS (0 << CAMCIR_ARM_TIMER0_INT_REQ_OFFS) - -#define CAMCIR_ARM_TIMER1_INT_REQ_OFFS 2 -#define CAMCIR_ARM_TIMER1_INT_REQ_MASK BIT2 -#define CAMCIR_ARM_TIMER1_INT_REQ_EN (1 << CAMCIR_ARM_TIMER1_INT_REQ_OFFS) -#define CAMCIR_ARM_TIMER1_INT_REQ_DIS (0 << CAMCIR_ARM_TIMER1_INT_REQ_OFFS) - -#define CAMCIR_ARM_WD_TIMER_INT_REQ_OFFS 3 -#define CAMCIR_ARM_WD_TIMER_INT_REQ_MASK BIT3 -#define CAMCIR_ARM_WD_TIMER_INT_REQ_EN (1 << CAMCIR_ARM_WD_TIMER_INT_REQ_OFFS) -#define CAMCIR_ARM_WD_TIMER_INT_REQ_DIS (0 << CAMCIR_ARM_WD_TIMER_INT_REQ_OFFS) - -/* CPU FTDLL Config register (CFCR) fields */ -#define CFCR_FTDLL_ICACHE_TAG_OFFS 0 -#define CFCR_FTDLL_ICACHE_TAG_MASK (0x7F << CFCR_FTDLL_ICACHE_TAG_OFFS) -#define CFCR_FTDLL_DCACHE_TAG_OFFS 8 -#define CFCR_FTDLL_DCACHE_TAG_MASK (0x7F << CFCR_FTDLL_DCACHE_TAG_OFFS) -#define CFCR_FTDLL_OVERWRITE_ENABLE (1 << 15) -/* For Orion 2 D2 only */ -#define CFCR_MRVL_CPU_ID_OFFS 16 -#define CFCR_MRVL_CPU_ID_MASK (0x1 << CFCR_MRVL_CPU_ID_OFFS) -#define CFCR_ARM_CPU_ID (0x0 << CFCR_MRVL_CPU_ID_OFFS) -#define CFCR_MRVL_CPU_ID (0x1 << CFCR_MRVL_CPU_ID_OFFS) -#define CFCR_VFP_SUB_ARC_NUM_OFFS 7 -#define CFCR_VFP_SUB_ARC_NUM_MASK (0x1 << CFCR_VFP_SUB_ARC_NUM_OFFS) -#define CFCR_VFP_SUB_ARC_NUM_1 (0x0 << CFCR_VFP_SUB_ARC_NUM_OFFS) -#define CFCR_VFP_SUB_ARC_NUM_2 (0x1 << CFCR_VFP_SUB_ARC_NUM_OFFS) - -/* CPU_L2_CONFIG_REG fields */ -#ifdef MV_CPU_LE -#define CL2CR_L2_ECC_EN_OFFS 2 -#define CL2CR_L2_WT_MODE_OFFS 4 -#else -#define CL2CR_L2_ECC_EN_OFFS 26 -#define CL2CR_L2_WT_MODE_OFFS 28 -#endif - -#define CL2CR_L2_ECC_EN_MASK (1 << CL2CR_L2_ECC_EN_OFFS) -#define CL2CR_L2_WT_MODE_MASK (1 << CL2CR_L2_WT_MODE_OFFS) - -/*******************************************/ -/* Main Interrupt Controller Registers Map */ -/*******************************************/ - -#define CPU_MAIN_INT_CAUSE_REG 0x20200 -#define CPU_MAIN_IRQ_MASK_REG 0x20204 -#define CPU_MAIN_FIQ_MASK_REG 0x20208 -#define CPU_ENPOINT_MASK_REG 0x2020C -#define CPU_MAIN_INT_CAUSE_HIGH_REG 0x20210 -#define CPU_MAIN_IRQ_MASK_HIGH_REG 0x20214 -#define CPU_MAIN_FIQ_MASK_HIGH_REG 0x20218 -#define CPU_ENPOINT_MASK_HIGH_REG 0x2021C - - -/*******************************************/ -/* ARM Doorbell Registers Map */ -/*******************************************/ - -#define CPU_HOST_TO_ARM_DRBL_REG 0x20400 -#define CPU_HOST_TO_ARM_MASK_REG 0x20404 -#define CPU_ARM_TO_HOST_DRBL_REG 0x20408 -#define CPU_ARM_TO_HOST_MASK_REG 0x2040C - - - -/* CPU control register map */ -/* Set bits means value is about to change according to new value */ -#define CPU_CONFIG_DEFAULT_MASK (CCR_VEC_INIT_LOC_MASK | CCR_AHB_ERROR_PROP_MASK) - -#define CPU_CONFIG_DEFAULT (CCR_VEC_INIT_LOC_FF00) - -/* CPU Control and status defaults */ -#define CPU_CTRL_STAT_DEFAULT_MASK (CCSR_PCI_ACCESS_MASK) - - -#define CPU_CTRL_STAT_DEFAULT (CCSR_PCI_ACCESS_ENABLE) - -#endif /* __INCmvCpuIfRegsh */ - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysAudio.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysAudio.c deleted file mode 100644 index 769475f8f4..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysAudio.c +++ /dev/null @@ -1,324 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ -#include "mvSysAudio.h" - -/******************************************************************************* -* mvAudioWinSet - Set AUDIO target address window -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) -* address window, also known as address decode window. -* After setting this target window, the AUDIO will be able to access the -* target within the address window. -* -* INPUT: -* winNum - AUDIO target address decode window number. -* pAddrDecWin - AUDIO target window data structure. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if address window overlapps with other address decode windows. -* MV_BAD_PARAM if base address is invalid parameter or target is -* unknown. -* -*******************************************************************************/ -MV_STATUS mvAudioWinSet(MV_U32 winNum, MV_AUDIO_DEC_WIN *pAddrDecWin) -{ - MV_TARGET_ATTRIB targetAttribs; - MV_DEC_REGS decRegs; - - /* Parameter checking */ - if (winNum >= MV_AUDIO_MAX_ADDR_DECODE_WIN) - { - mvOsPrintf("%s: ERR. Invalid win num %d\n",__FUNCTION__, winNum); - return MV_BAD_PARAM; - } - - /* check if address is aligned to the size */ - if(MV_IS_NOT_ALIGN(pAddrDecWin->addrWin.baseLow, pAddrDecWin->addrWin.size)) - { - mvOsPrintf("mvAudioWinSet:Error setting AUDIO window %d to "\ - "target %s.\nAddress 0x%08x is unaligned to size 0x%x.\n", - winNum, - mvCtrlTargetNameGet(pAddrDecWin->target), - pAddrDecWin->addrWin.baseLow, - pAddrDecWin->addrWin.size); - return MV_ERROR; - } - - decRegs.baseReg = 0; - decRegs.sizeReg = 0; - - if (MV_OK != mvCtrlAddrDecToReg(&(pAddrDecWin->addrWin),&decRegs)) - { - mvOsPrintf("%s: mvCtrlAddrDecToReg Failed\n", __FUNCTION__); - return MV_ERROR; - } - - mvCtrlAttribGet(pAddrDecWin->target, &targetAttribs); - - /* set attributes */ - decRegs.sizeReg &= ~MV_AUDIO_WIN_ATTR_MASK; - decRegs.sizeReg |= (targetAttribs.attrib << MV_AUDIO_WIN_ATTR_OFFSET); - - /* set target ID */ - decRegs.sizeReg &= ~MV_AUDIO_WIN_TARGET_MASK; - decRegs.sizeReg |= (targetAttribs.targetId << MV_AUDIO_WIN_TARGET_OFFSET); - - if (pAddrDecWin->enable == MV_TRUE) - { - decRegs.sizeReg |= MV_AUDIO_WIN_ENABLE_MASK; - } - else - { - decRegs.sizeReg &= ~MV_AUDIO_WIN_ENABLE_MASK; - } - - MV_REG_WRITE( MV_AUDIO_WIN_CTRL_REG(winNum), decRegs.sizeReg); - MV_REG_WRITE( MV_AUDIO_WIN_BASE_REG(winNum), decRegs.baseReg); - - return MV_OK; -} - -/******************************************************************************* -* mvAudioWinGet - Get AUDIO peripheral target address window. -* -* DESCRIPTION: -* Get AUDIO peripheral target address window. -* -* INPUT: -* winNum - AUDIO target address decode window number. -* -* OUTPUT: -* pAddrDecWin - AUDIO target window data structure. -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvAudioWinGet(MV_U32 winNum, MV_AUDIO_DEC_WIN *pAddrDecWin) -{ - MV_DEC_REGS decRegs; - MV_TARGET_ATTRIB targetAttrib; - - /* Parameter checking */ - if (winNum >= MV_AUDIO_MAX_ADDR_DECODE_WIN) - { - mvOsPrintf("%s : ERR. Invalid winNum %d\n", - __FUNCTION__, winNum); - return MV_NOT_SUPPORTED; - } - - decRegs.baseReg = MV_REG_READ( MV_AUDIO_WIN_BASE_REG(winNum) ); - decRegs.sizeReg = MV_REG_READ( MV_AUDIO_WIN_CTRL_REG(winNum) ); - - if (MV_OK != mvCtrlRegToAddrDec(&decRegs, &pAddrDecWin->addrWin) ) - { - mvOsPrintf("%s: mvCtrlRegToAddrDec Failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* attrib and targetId */ - targetAttrib.attrib = (decRegs.sizeReg & MV_AUDIO_WIN_ATTR_MASK) >> - MV_AUDIO_WIN_ATTR_OFFSET; - targetAttrib.targetId = (decRegs.sizeReg & MV_AUDIO_WIN_TARGET_MASK) >> - MV_AUDIO_WIN_TARGET_OFFSET; - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - /* Check if window is enabled */ - if(decRegs.sizeReg & MV_AUDIO_WIN_ENABLE_MASK) - { - pAddrDecWin->enable = MV_TRUE; - } - else - { - pAddrDecWin->enable = MV_FALSE; - } - return MV_OK; -} -/******************************************************************************* -* mvAudioAddrDecShow - Print the AUDIO address decode map. -* -* DESCRIPTION: -* This function print the AUDIO address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvAudioAddrDecShow(MV_VOID) -{ - - MV_AUDIO_DEC_WIN win; - int i; - - if (MV_FALSE == mvCtrlPwrClckGet(AUDIO_UNIT_ID, 0)) - return; - - - mvOsOutput( "\n" ); - mvOsOutput( "AUDIO:\n" ); - mvOsOutput( "----\n" ); - - for( i = 0; i < MV_AUDIO_MAX_ADDR_DECODE_WIN; i++ ) - { - memset( &win, 0, sizeof(MV_AUDIO_DEC_WIN) ); - - mvOsOutput( "win%d - ", i ); - - if( mvAudioWinGet( i, &win ) == MV_OK ) - { - if( win.enable ) - { - mvOsOutput( "%s base %08x, ", - mvCtrlTargetNameGet(win.target), win.addrWin.baseLow ); - mvOsOutput( "...." ); - - mvSizePrint( win.addrWin.size ); - - mvOsOutput( "\n" ); - } - else - mvOsOutput( "disable\n" ); - } - } -} - - -/******************************************************************************* -* mvAudioWinInit - Initialize the integrated AUDIO target address window. -* -* DESCRIPTION: -* Initialize the AUDIO peripheral target address window. -* -* INPUT: -* -* -* OUTPUT: -* -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvAudioInit(MV_VOID) -{ - int winNum; - MV_AUDIO_DEC_WIN audioWin; - MV_CPU_DEC_WIN cpuAddrDecWin; - MV_U32 status; - - mvAudioHalInit(); - - /* Initiate Audio address decode */ - - /* First disable all address decode windows */ - for(winNum = 0; winNum < MV_AUDIO_MAX_ADDR_DECODE_WIN; winNum++) - { - MV_U32 regVal = MV_REG_READ(MV_AUDIO_WIN_CTRL_REG(winNum)); - regVal &= ~MV_AUDIO_WIN_ENABLE_MASK; - MV_REG_WRITE(MV_AUDIO_WIN_CTRL_REG(winNum), regVal); - } - - for(winNum = 0; winNum < MV_AUDIO_MAX_ADDR_DECODE_WIN; winNum++) - { - - /* We will set the Window to DRAM_CS0 in default */ - /* first get attributes from CPU If */ - status = mvCpuIfTargetWinGet(SDRAM_CS0, - &cpuAddrDecWin); - - if (MV_OK != status) - { - mvOsPrintf("%s: ERR. mvCpuIfTargetWinGet failed\n", __FUNCTION__); - return MV_ERROR; - } - - if (cpuAddrDecWin.enable == MV_TRUE) - { - audioWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; - audioWin.addrWin.baseLow = cpuAddrDecWin.addrWin.baseLow; - audioWin.addrWin.size = cpuAddrDecWin.addrWin.size; - audioWin.enable = MV_TRUE; - audioWin.target = SDRAM_CS0; - - if(MV_OK != mvAudioWinSet(winNum, &audioWin)) - { - return MV_ERROR; - } - } - } - - return MV_OK; -} - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysAudio.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysAudio.h deleted file mode 100644 index f59eb9a904..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysAudio.h +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ -#ifndef __INCMVSysAudioH -#define __INCMVSysAudioH - -#include "mvCommon.h" -#include "audio/mvAudio.h" -#include "ctrlEnv/mvCtrlEnvSpec.h" -#include "ctrlEnv/sys/mvCpuIf.h" - -/***********************************/ -/* Audio Address Decoding registers*/ -/***********************************/ - -#define MV_AUDIO_MAX_ADDR_DECODE_WIN 2 -#define MV_AUDIO_RECORD_WIN_NUM 0 -#define MV_AUDIO_PLAYBACK_WIN_NUM 1 - -#define MV_AUDIO_WIN_CTRL_REG(win) (AUDIO_REG_BASE + 0xA04 + ((win)<<3)) -#define MV_AUDIO_WIN_BASE_REG(win) (AUDIO_REG_BASE + 0xA00 + ((win)<<3)) - -#define MV_AUDIO_RECORD_WIN_CTRL_REG MV_AUDIO_WIN_CTRL_REG(MV_AUDIO_RECORD_WIN_NUM) -#define MV_AUDIO_RECORD_WIN_BASE_REG MV_AUDIO_WIN_BASE_REG(MV_AUDIO_RECORD_WIN_NUM) -#define MV_AUDIO_PLAYBACK_WIN_CTRL_REG MV_AUDIO_WIN_CTRL_REG(MV_AUDIO_PLAYBACK_WIN_NUM) -#define MV_AUDIO_PLAYBACK_WIN_BASE_REG MV_AUDIO_WIN_BASE_REG(MV_AUDIO_PLAYBACK_WIN_NUM) - - -/* BITs in Windows 0-3 Control and Base Registers */ -#define MV_AUDIO_WIN_ENABLE_BIT 0 -#define MV_AUDIO_WIN_ENABLE_MASK (1<<MV_AUDIO_WIN_ENABLE_BIT) - -#define MV_AUDIO_WIN_TARGET_OFFSET 4 -#define MV_AUDIO_WIN_TARGET_MASK (0xF<<MV_AUDIO_WIN_TARGET_OFFSET) - -#define MV_AUDIO_WIN_ATTR_OFFSET 8 -#define MV_AUDIO_WIN_ATTR_MASK (0xFF<<MV_AUDIO_WIN_ATTR_OFFSET) - -#define MV_AUDIO_WIN_SIZE_OFFSET 16 -#define MV_AUDIO_WIN_SIZE_MASK (0xFFFF<<MV_AUDIO_WIN_SIZE_OFFSET) - -#define MV_AUDIO_WIN_BASE_OFFSET 16 -#define MV_AUDIO_WIN_BASE_MASK (0xFFFF<<MV_AUDIO_WIN_BASE_OFFSET) - - -typedef struct _mvAudioDecWin -{ - MV_TARGET target; - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -} MV_AUDIO_DEC_WIN; - - -MV_STATUS mvAudioInit(MV_VOID); -MV_STATUS mvAudioWinGet(MV_U32 winNum, MV_AUDIO_DEC_WIN *pAddrDecWin); -MV_STATUS mvAudioWinSet(MV_U32 winNum, MV_AUDIO_DEC_WIN *pAddrDecWin); -MV_STATUS mvAudioWinInit(MV_VOID); -MV_VOID mvAudioAddrDecShow(MV_VOID); - - -#endif - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysCesa.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysCesa.c deleted file mode 100644 index 84d0cd0bd7..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysCesa.c +++ /dev/null @@ -1,382 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include "mvSysCesa.h" - -#if (MV_CESA_VERSION >= 2) -MV_TARGET tdmaAddrDecPrioTable[] = -{ -#if defined(MV_INCLUDE_SDRAM_CS0) - SDRAM_CS0, -#endif -#if defined(MV_INCLUDE_SDRAM_CS1) - SDRAM_CS1, -#endif -#if defined(MV_INCLUDE_SDRAM_CS2) - SDRAM_CS2, -#endif -#if defined(MV_INCLUDE_SDRAM_CS3) - SDRAM_CS3, -#endif -#if defined(MV_INCLUDE_PEX) - PEX0_MEM, -#endif - - TBL_TERM -}; - -/******************************************************************************* -* mvCesaWinGet - Get TDMA target address window. -* -* DESCRIPTION: -* Get TDMA target address window. -* -* INPUT: -* winNum - TDMA target address decode window number. -* -* OUTPUT: -* pDecWin - TDMA target window data structure. -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -static MV_STATUS mvCesaWinGet(MV_U32 winNum, MV_DEC_WIN *pDecWin) -{ - MV_DEC_WIN_PARAMS winParam; - MV_U32 sizeReg, baseReg; - - /* Parameter checking */ - if (winNum >= MV_CESA_TDMA_ADDR_DEC_WIN) - { - mvOsPrintf("%s : ERR. Invalid winNum %d\n", - __FUNCTION__, winNum); - return MV_NOT_SUPPORTED; - } - - baseReg = MV_REG_READ( MV_CESA_TDMA_BASE_ADDR_REG(winNum) ); - sizeReg = MV_REG_READ( MV_CESA_TDMA_WIN_CTRL_REG(winNum) ); - - /* Check if window is enabled */ - if(sizeReg & MV_CESA_TDMA_WIN_ENABLE_MASK) - { - pDecWin->enable = MV_TRUE; - - /* Extract window parameters from registers */ - winParam.targetId = (sizeReg & MV_CESA_TDMA_WIN_TARGET_MASK) >> MV_CESA_TDMA_WIN_TARGET_OFFSET; - winParam.attrib = (sizeReg & MV_CESA_TDMA_WIN_ATTR_MASK) >> MV_CESA_TDMA_WIN_ATTR_OFFSET; - winParam.size = (sizeReg & MV_CESA_TDMA_WIN_SIZE_MASK) >> MV_CESA_TDMA_WIN_SIZE_OFFSET; - winParam.baseAddr = (baseReg & MV_CESA_TDMA_WIN_BASE_MASK); - - /* Translate the decode window parameters to address decode struct */ - if (MV_OK != mvCtrlParamsToAddrDec(&winParam, pDecWin)) - { - mvOsPrintf("Failed to translate register parameters to CESA address" \ - " decode window structure\n"); - return MV_ERROR; - } - } - else - { - pDecWin->enable = MV_FALSE; - } - return MV_OK; -} - -/******************************************************************************* -* cesaWinOverlapDetect - Detect CESA TDMA address windows overlapping -* -* DESCRIPTION: -* An unpredicted behaviur is expected in case TDMA address decode -* windows overlapps. -* This function detects TDMA address decode windows overlapping of a -* specified window. The function does not check the window itself for -* overlapping. The function also skipps disabled address decode windows. -* -* INPUT: -* winNum - address decode window number. -* pAddrDecWin - An address decode window struct. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE - if the given address window overlap current address -* decode map, -* MV_FALSE - otherwise, MV_ERROR if reading invalid data -* from registers. -* -*******************************************************************************/ -static MV_STATUS cesaWinOverlapDetect(MV_U32 winNum, MV_ADDR_WIN *pAddrWin) -{ - MV_U32 winNumIndex; - MV_DEC_WIN addrDecWin; - - for(winNumIndex=0; winNumIndex<MV_CESA_TDMA_ADDR_DEC_WIN; winNumIndex++) - { - /* Do not check window itself */ - if (winNumIndex == winNum) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvCesaWinGet(winNumIndex, &addrDecWin)) - { - mvOsPrintf("%s: ERR. TargetWinGet failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* Do not check disabled windows */ - if(addrDecWin.enable == MV_FALSE) - { - continue; - } - - if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin))) - { - return MV_TRUE; - } - } - return MV_FALSE; -} - -/******************************************************************************* -* mvCesaTdmaWinSet - Set CESA TDMA target address window -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) -* address window, also known as address decode window. -* After setting this target window, the CESA TDMA will be able to access the -* target within the address window. -* -* INPUT: -* winNum - CESA TDMA target address decode window number. -* pAddrDecWin - CESA TDMA target window data structure. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR - if address window overlapps with other address decode windows. -* MV_BAD_PARAM - if base address is invalid parameter or target is -* unknown. -* -*******************************************************************************/ -static MV_STATUS mvCesaTdmaWinSet(MV_U32 winNum, MV_DEC_WIN *pDecWin) -{ - MV_DEC_WIN_PARAMS winParams; - MV_U32 sizeReg, baseReg; - - /* Parameter checking */ - if (winNum >= MV_CESA_TDMA_ADDR_DEC_WIN) - { - mvOsPrintf("mvCesaTdmaWinSet: ERR. Invalid win num %d\n",winNum); - return MV_BAD_PARAM; - } - - /* Check if the requested window overlapps with current windows */ - if (MV_TRUE == cesaWinOverlapDetect(winNum, &pDecWin->addrWin)) - { - mvOsPrintf("%s: ERR. Window %d overlap\n", __FUNCTION__, winNum); - return MV_ERROR; - } - - /* check if address is aligned to the size */ - if(MV_IS_NOT_ALIGN(pDecWin->addrWin.baseLow, pDecWin->addrWin.size)) - { - mvOsPrintf("mvCesaTdmaWinSet: Error setting CESA TDMA window %d to "\ - "target %s.\nAddress 0x%08x is unaligned to size 0x%x.\n", - winNum, - mvCtrlTargetNameGet(pDecWin->target), - pDecWin->addrWin.baseLow, - pDecWin->addrWin.size); - return MV_ERROR; - } - - if(MV_OK != mvCtrlAddrDecToParams(pDecWin, &winParams)) - { - mvOsPrintf("%s: mvCtrlAddrDecToParams Failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* set Size, Attributes and TargetID */ - sizeReg = (((winParams.targetId << MV_CESA_TDMA_WIN_TARGET_OFFSET) & MV_CESA_TDMA_WIN_TARGET_MASK) | - ((winParams.attrib << MV_CESA_TDMA_WIN_ATTR_OFFSET) & MV_CESA_TDMA_WIN_ATTR_MASK) | - ((winParams.size << MV_CESA_TDMA_WIN_SIZE_OFFSET) & MV_CESA_TDMA_WIN_SIZE_MASK)); - - if (pDecWin->enable == MV_TRUE) - { - sizeReg |= MV_CESA_TDMA_WIN_ENABLE_MASK; - } - else - { - sizeReg &= ~MV_CESA_TDMA_WIN_ENABLE_MASK; - } - - /* Update Base value */ - baseReg = (winParams.baseAddr & MV_CESA_TDMA_WIN_BASE_MASK); - - MV_REG_WRITE( MV_CESA_TDMA_WIN_CTRL_REG(winNum), sizeReg); - MV_REG_WRITE( MV_CESA_TDMA_BASE_ADDR_REG(winNum), baseReg); - - return MV_OK; -} - - -static MV_STATUS mvCesaTdmaAddrDecInit (void) -{ - MV_U32 winNum; - MV_STATUS status; - MV_CPU_DEC_WIN cpuAddrDecWin; - MV_DEC_WIN cesaWin; - MV_U32 winPrioIndex = 0; - - /* First disable all address decode windows */ - for(winNum=0; winNum<MV_CESA_TDMA_ADDR_DEC_WIN; winNum++) - { - MV_REG_BIT_RESET(MV_CESA_TDMA_WIN_CTRL_REG(winNum), MV_CESA_TDMA_WIN_ENABLE_MASK); - } - - /* Go through all windows in user table until table terminator */ - winNum = 0; - while( (tdmaAddrDecPrioTable[winPrioIndex] != TBL_TERM) && - (winNum < MV_CESA_TDMA_ADDR_DEC_WIN) ) { - - /* first get attributes from CPU If */ - status = mvCpuIfTargetWinGet(tdmaAddrDecPrioTable[winPrioIndex], - &cpuAddrDecWin); - if(MV_NO_SUCH == status){ - winPrioIndex++; - continue; - } - - if (MV_OK != status) - { - mvOsPrintf("cesaInit: TargetWinGet failed. winNum=%d, winIdx=%d, target=%d, status=0x%x\n", - winNum, winPrioIndex, tdmaAddrDecPrioTable[winPrioIndex], status); - return MV_ERROR; - } - if (cpuAddrDecWin.enable == MV_TRUE) - { - cesaWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; - cesaWin.addrWin.baseLow = cpuAddrDecWin.addrWin.baseLow; - cesaWin.addrWin.size = cpuAddrDecWin.addrWin.size; - cesaWin.enable = MV_TRUE; - cesaWin.target = tdmaAddrDecPrioTable[winPrioIndex]; - -#if defined(MV646xx) - /* Get the default attributes for that target window */ - mvCtrlDefAttribGet(cesaWin.target, &cesaWin.addrWinAttr); -#endif /* MV646xx */ - - if(MV_OK != mvCesaTdmaWinSet(winNum, &cesaWin)) - { - mvOsPrintf("mvCesaTdmaWinSet FAILED: winNum=%d\n", - winNum); - return MV_ERROR; - } - winNum++; - } - winPrioIndex++; - } - return MV_OK; -} -#endif /* MV_CESA_VERSION >= 2 */ - - - - -MV_STATUS mvCesaInit (int numOfSession, int queueDepth, char* pSramBase, void *osHandle) -{ - MV_U32 cesaCryptEngBase; - MV_CPU_DEC_WIN addrDecWin; - - if(sizeof(MV_CESA_SRAM_MAP) > MV_CESA_SRAM_SIZE) - { - mvOsPrintf("mvCesaInit: Wrong SRAM map - %ld > %d\n", - sizeof(MV_CESA_SRAM_MAP), MV_CESA_SRAM_SIZE); - return MV_FAIL; - } -#if 0 - if (mvCpuIfTargetWinGet(CRYPT_ENG, &addrDecWin) == MV_OK) - cesaCryptEngBase = addrDecWin.addrWin.baseLow; - else - { - mvOsPrintf("mvCesaInit: ERR. mvCpuIfTargetWinGet failed\n"); - return MV_ERROR; - } -#else - cesaCryptEngBase = (MV_U32)pSramBase; -#endif - -#if 0 /* Already done in the platform init */ -#if (MV_CESA_VERSION >= 2) - mvCesaTdmaAddrDecInit(); -#endif /* MV_CESA_VERSION >= 2 */ -#endif - return mvCesaHalInit(numOfSession, queueDepth, pSramBase, cesaCryptEngBase, - osHandle); - -} diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysCesa.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysCesa.h deleted file mode 100644 index 73bcdc5832..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysCesa.h +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __mvSysCesa_h__ -#define __mvSysCesa_h__ - - -#include "mvCommon.h" -#include "cesa/mvCesa.h" -#include "ctrlEnv/mvCtrlEnvSpec.h" -#include "ctrlEnv/sys/mvCpuIf.h" - -/***************************** TDMA Registers *************************************/ - -#define MV_CESA_TDMA_ADDR_DEC_WIN 4 - -#define MV_CESA_TDMA_BASE_ADDR_REG(win) (MV_CESA_TDMA_REG_BASE + 0xa00 + (win<<3)) - -#define MV_CESA_TDMA_WIN_CTRL_REG(win) (MV_CESA_TDMA_REG_BASE + 0xa04 + (win<<3)) - -#define MV_CESA_TDMA_WIN_ENABLE_BIT 0 -#define MV_CESA_TDMA_WIN_ENABLE_MASK (1 << MV_CESA_TDMA_WIN_ENABLE_BIT) - -#define MV_CESA_TDMA_WIN_TARGET_OFFSET 4 -#define MV_CESA_TDMA_WIN_TARGET_MASK (0xf << MV_CESA_TDMA_WIN_TARGET_OFFSET) - -#define MV_CESA_TDMA_WIN_ATTR_OFFSET 8 -#define MV_CESA_TDMA_WIN_ATTR_MASK (0xff << MV_CESA_TDMA_WIN_ATTR_OFFSET) - -#define MV_CESA_TDMA_WIN_SIZE_OFFSET 16 -#define MV_CESA_TDMA_WIN_SIZE_MASK (0xFFFF << MV_CESA_TDMA_WIN_SIZE_OFFSET) - -#define MV_CESA_TDMA_WIN_BASE_OFFSET 16 -#define MV_CESA_TDMA_WIN_BASE_MASK (0xFFFF << MV_CESA_TDMA_WIN_BASE_OFFSET) - - -MV_STATUS mvCesaInit (int numOfSession, int queueDepth, char* pSramBase, void *osHandle); - -#endif diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysDram.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysDram.c deleted file mode 100644 index 6f76c2caa9..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysDram.c +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -/* includes */ - -#include "ddr2/mvDramIf.h" -#include "ctrlEnv/sys/mvCpuIf.h" -#include "ctrlEnv/sys/mvSysDram.h" - -/* #define MV_DEBUG */ -#ifdef MV_DEBUG -#define DB(x) x -#else -#define DB(x) -#endif - -static MV_BOOL sdramIfWinOverlap(MV_TARGET target, MV_ADDR_WIN *pAddrWin); - -/******************************************************************************* -* mvDramIfWinSet - Set DRAM interface address decode window -* -* DESCRIPTION: -* This function sets DRAM interface address decode window. -* -* INPUT: -* target - System target. Use only SDRAM targets. -* pAddrDecWin - SDRAM address window structure. -* -* OUTPUT: -* None -* -* RETURN: -* MV_BAD_PARAM if parameters are invalid or window is invalid, MV_OK -* otherwise. -*******************************************************************************/ -MV_STATUS mvDramIfWinSet(MV_TARGET target, MV_DRAM_DEC_WIN *pAddrDecWin) -{ - MV_U32 baseReg=0,sizeReg=0; - MV_U32 baseToReg=0 , sizeToReg=0; - - /* Check parameters */ - if (!MV_TARGET_IS_DRAM(target)) - { - mvOsPrintf("mvDramIfWinSet: target %d is not SDRAM\n", target); - return MV_BAD_PARAM; - } - - /* Check if the requested window overlaps with current enabled windows */ - if (MV_TRUE == sdramIfWinOverlap(target, &pAddrDecWin->addrWin)) - { - mvOsPrintf("mvDramIfWinSet: ERR. Target %d overlaps\n", target); - return MV_BAD_PARAM; - } - - /* check if address is aligned to the size */ - if(MV_IS_NOT_ALIGN(pAddrDecWin->addrWin.baseLow, pAddrDecWin->addrWin.size)) - { - mvOsPrintf("mvDramIfWinSet:Error setting DRAM interface window %d."\ - "\nAddress 0x%08x is unaligned to size 0x%x.\n", - target, - pAddrDecWin->addrWin.baseLow, - pAddrDecWin->addrWin.size); - return MV_ERROR; - } - - /* read base register*/ - baseReg = MV_REG_READ(SDRAM_BASE_ADDR_REG(0,target)); - - /* read size register */ - sizeReg = MV_REG_READ(SDRAM_SIZE_REG(0,target)); - - /* BaseLow[31:16] => base register [31:16] */ - baseToReg = pAddrDecWin->addrWin.baseLow & SCBAR_BASE_MASK; - - /* Write to address decode Base Address Register */ - baseReg &= ~SCBAR_BASE_MASK; - baseReg |= baseToReg; - - /* Translate the given window size to register format */ - sizeToReg = ctrlSizeToReg(pAddrDecWin->addrWin.size, SCSR_SIZE_ALIGNMENT); - - /* Size parameter validity check. */ - if (-1 == sizeToReg) - { - mvOsPrintf("mvCtrlAddrDecToReg: ERR. Win %d size invalid.\n",target); - return MV_BAD_PARAM; - } - - /* set size */ - sizeReg &= ~SCSR_SIZE_MASK; - /* Size is located at upper 16 bits */ - sizeReg |= (sizeToReg << SCSR_SIZE_OFFS); - - /* enable/Disable */ - if (MV_TRUE == pAddrDecWin->enable) - { - sizeReg |= SCSR_WIN_EN; - } - else - { - sizeReg &= ~SCSR_WIN_EN; - } - - /* 3) Write to address decode Base Address Register */ - MV_REG_WRITE(SDRAM_BASE_ADDR_REG(0,target), baseReg); - - /* Write to address decode Size Register */ - MV_REG_WRITE(SDRAM_SIZE_REG(0,target), sizeReg); - - return MV_OK; -} -/******************************************************************************* -* mvDramIfWinGet - Get DRAM interface address decode window -* -* DESCRIPTION: -* This function gets DRAM interface address decode window. -* -* INPUT: -* target - System target. Use only SDRAM targets. -* -* OUTPUT: -* pAddrDecWin - SDRAM address window structure. -* -* RETURN: -* MV_BAD_PARAM if parameters are invalid or window is invalid, MV_OK -* otherwise. -*******************************************************************************/ -MV_STATUS mvDramIfWinGet(MV_TARGET target, MV_DRAM_DEC_WIN *pAddrDecWin) -{ - MV_U32 baseReg,sizeReg; - MV_U32 sizeRegVal; - /* Check parameters */ - if (!MV_TARGET_IS_DRAM(target)) - { - mvOsPrintf("mvDramIfWinGet: target %d is Illigal\n", target); - return MV_ERROR; - } - - /* Read base and size registers */ - sizeReg = MV_REG_READ(SDRAM_SIZE_REG(0,target)); - baseReg = MV_REG_READ(SDRAM_BASE_ADDR_REG(0,target)); - - sizeRegVal = (sizeReg & SCSR_SIZE_MASK) >> SCSR_SIZE_OFFS; - - pAddrDecWin->addrWin.size = ctrlRegToSize(sizeRegVal, - SCSR_SIZE_ALIGNMENT); - - /* Check if ctrlRegToSize returned OK */ - if (-1 == pAddrDecWin->addrWin.size) - { - mvOsPrintf("mvDramIfWinGet: size of target %d is Illigal\n", target); - return MV_ERROR; - } - - /* Extract base address */ - /* Base register [31:16] ==> baseLow[31:16] */ - pAddrDecWin->addrWin.baseLow = baseReg & SCBAR_BASE_MASK; - - pAddrDecWin->addrWin.baseHigh = 0; - - - if (sizeReg & SCSR_WIN_EN) - { - pAddrDecWin->enable = MV_TRUE; - } - else - { - pAddrDecWin->enable = MV_FALSE; - } - - return MV_OK; -} -/******************************************************************************* -* mvDramIfWinEnable - Enable/Disable SDRAM address decode window -* -* DESCRIPTION: -* This function enable/Disable SDRAM address decode window. -* -* INPUT: -* target - System target. Use only SDRAM targets. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR in case function parameter are invalid, MV_OK otherewise. -* -*******************************************************************************/ -MV_STATUS mvDramIfWinEnable(MV_TARGET target, MV_BOOL enable) -{ - MV_DRAM_DEC_WIN addrDecWin; - - /* Check parameters */ - if (!MV_TARGET_IS_DRAM(target)) - { - mvOsPrintf("mvDramIfWinEnable: target %d is Illigal\n", target); - return MV_ERROR; - } - - if (enable == MV_TRUE) - { /* First check for overlap with other enabled windows */ - if (MV_OK != mvDramIfWinGet(target, &addrDecWin)) - { - mvOsPrintf("mvDramIfWinEnable:ERR. Getting target %d failed.\n", - target); - return MV_ERROR; - } - /* Check for overlapping */ - if (MV_FALSE == sdramIfWinOverlap(target, &(addrDecWin.addrWin))) - { - /* No Overlap. Enable address decode winNum window */ - MV_REG_BIT_SET(SDRAM_SIZE_REG(0,target), SCSR_WIN_EN); - } - else - { /* Overlap detected */ - mvOsPrintf("mvDramIfWinEnable: ERR. Target %d overlap detect\n", - target); - return MV_ERROR; - } - } - else - { /* Disable address decode winNum window */ - MV_REG_BIT_RESET(SDRAM_SIZE_REG(0, target), SCSR_WIN_EN); - } - - return MV_OK; -} - -/******************************************************************************* -* sdramIfWinOverlap - Check if an address window overlap an SDRAM address window -* -* DESCRIPTION: -* This function scan each SDRAM address decode window to test if it -* overlapps the given address windoow -* -* INPUT: -* target - SDRAM target where the function skips checking. -* pAddrDecWin - The tested address window for overlapping with -* SDRAM windows. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlaps any enabled address -* decode map, MV_FALSE otherwise. -* -*******************************************************************************/ -static MV_BOOL sdramIfWinOverlap(MV_TARGET target, MV_ADDR_WIN *pAddrWin) -{ - MV_TARGET targetNum; - MV_DRAM_DEC_WIN addrDecWin; - - for(targetNum = SDRAM_CS0; targetNum < MV_DRAM_MAX_CS ; targetNum++) - { - /* don't check our winNum or illegal targets */ - if (targetNum == target) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvDramIfWinGet(targetNum, &addrDecWin)) - { - mvOsPrintf("sdramIfWinOverlap: ERR. TargetWinGet failed\n"); - return MV_ERROR; - } - - /* Do not check disabled windows */ - if (MV_FALSE == addrDecWin.enable) - { - continue; - } - - if(MV_TRUE == ctrlWinOverlapTest(pAddrWin, &addrDecWin.addrWin)) - { - mvOsPrintf( - "sdramIfWinOverlap: Required target %d overlap winNum %d\n", - target, targetNum); - return MV_TRUE; - } - } - - return MV_FALSE; -} - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysDram.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysDram.h deleted file mode 100644 index 7bd9c9de27..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysDram.h +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#ifndef __sysDram -#define __sysDram - -/* This structure describes CPU interface address decode window */ -typedef struct _mvDramIfDecWin -{ - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ -}MV_DRAM_DEC_WIN; - -MV_STATUS mvDramIfWinSet(MV_TARGET target, MV_DRAM_DEC_WIN *pAddrDecWin); -MV_STATUS mvDramIfWinGet(MV_TARGET target, MV_DRAM_DEC_WIN *pAddrDecWin); -MV_STATUS mvDramIfWinEnable(MV_TARGET target, MV_BOOL enable); - -#endif diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysGbe.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysGbe.c deleted file mode 100644 index 7f6e4a59dd..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysGbe.c +++ /dev/null @@ -1,658 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#include "ctrlEnv/sys/mvSysGbe.h" - - - -typedef struct _mvEthDecWin -{ - MV_TARGET target; - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -}MV_ETH_DEC_WIN; - -MV_TARGET ethAddrDecPrioTap[] = -{ -#if defined(MV_INCLUDE_SDRAM_CS0) - SDRAM_CS0, -#endif -#if defined(MV_INCLUDE_SDRAM_CS1) - SDRAM_CS1, -#endif -#if defined(MV_INCLUDE_SDRAM_CS2) - SDRAM_CS2, -#endif -#if defined(MV_INCLUDE_SDRAM_CS3) - SDRAM_CS3, -#endif -#if defined(MV_INCLUDE_DEVICE_CS0) - DEVICE_CS0, -#endif -#if defined(MV_INCLUDE_DEVICE_CS1) - DEVICE_CS1, -#endif -#if defined(MV_INCLUDE_DEVICE_CS2) - DEVICE_CS2, -#endif -#if defined(MV_INCLUDE_DEVICE_CS3) - DEVICE_CS3, -#endif -#if defined(MV_INCLUDE_PEX) - PEX0_IO, -#endif - TBL_TERM -}; - -static MV_STATUS ethWinOverlapDetect(int port, MV_U32 winNum, MV_ADDR_WIN *pAddrWin); -static MV_STATUS mvEthWinSet(int port, MV_U32 winNum, MV_ETH_DEC_WIN *pAddrDecWin); -static MV_STATUS mvEthWinGet(int port, MV_U32 winNum, MV_ETH_DEC_WIN *pAddrDecWin); - - -/******************************************************************************* -* mvEthWinInit - Initialize ETH address decode windows -* -* DESCRIPTION: -* This function initialize ETH window decode unit. It set the -* default address decode windows of the unit. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if setting fail. -*******************************************************************************/ -/* Configure EthDrv memory map registes. */ -MV_STATUS mvEthWinInit (int port) -{ - MV_U32 winNum, status, winPrioIndex=0, i, regVal=0; - MV_ETH_DEC_WIN ethWin; - MV_CPU_DEC_WIN cpuAddrDecWin; - static MV_U32 accessProtReg = 0; - -#if (MV_ETH_VERSION <= 1) - static MV_BOOL isFirst = MV_TRUE; - - if(isFirst == MV_FALSE) - { - MV_REG_WRITE(ETH_ACCESS_PROTECT_REG(port), accessProtReg); - return MV_OK; - } - isFirst = MV_FALSE; -#endif /* MV_GIGA_ETH_VERSION */ - - /* Initiate Ethernet address decode */ - - /* First disable all address decode windows */ - for(winNum=0; winNum<ETH_MAX_DECODE_WIN; winNum++) - { - regVal |= MV_BIT_MASK(winNum); - } - MV_REG_WRITE(ETH_BASE_ADDR_ENABLE_REG(port), regVal); - - /* Go through all windows in user table until table terminator */ - for (winNum=0; ((ethAddrDecPrioTap[winPrioIndex] != TBL_TERM) && - (winNum < ETH_MAX_DECODE_WIN)); ) - { - /* first get attributes from CPU If */ - status = mvCpuIfTargetWinGet(ethAddrDecPrioTap[winPrioIndex], - &cpuAddrDecWin); - - if(MV_NO_SUCH == status) - { - winPrioIndex++; - continue; - } - if (MV_OK != status) - { - mvOsPrintf("mvEthWinInit: ERR. mvCpuIfTargetWinGet failed\n"); - return MV_ERROR; - } - - if (cpuAddrDecWin.enable == MV_TRUE) - { - ethWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; - ethWin.addrWin.baseLow = cpuAddrDecWin.addrWin.baseLow; - ethWin.addrWin.size = cpuAddrDecWin.addrWin.size; - ethWin.enable = MV_TRUE; - ethWin.target = ethAddrDecPrioTap[winPrioIndex]; - - if(MV_OK != mvEthWinSet(port, winNum, ðWin)) - { - mvOsPrintf("mvEthWinInit: ERR. mvEthWinSet failed winNum=%d\n", - winNum); - return MV_ERROR; - } - winNum++; - } - winPrioIndex ++; - } - - /* set full access to all windows. */ - for(i=0; i<winNum; i++) - { - accessProtReg |= (FULL_ACCESS << (i*2)); - } - MV_REG_WRITE(ETH_ACCESS_PROTECT_REG(port), accessProtReg); - - return MV_OK; -} - -/******************************************************************************* -* mvEthWinSet - Set ETH target address window -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) -* address window, also known as address decode window. -* After setting this target window, the ETH will be able to access the -* target within the address window. -* -* INPUT: -* winNum - ETH to target address decode window number. -* pAddrDecWin - ETH target window data structure. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if address window overlapps with other address decode windows. -* MV_BAD_PARAM if base address is invalid parameter or target is -* unknown. -* -*******************************************************************************/ -MV_STATUS mvEthWinSet(int port, MV_U32 winNum, MV_ETH_DEC_WIN *pAddrDecWin) -{ - MV_TARGET_ATTRIB targetAttribs; - MV_DEC_REGS decRegs; - - /* Parameter checking */ - if (winNum >= ETH_MAX_DECODE_WIN) - { - mvOsPrintf("mvEthWinSet: ERR. Invalid win num %d\n",winNum); - return MV_BAD_PARAM; - } - - /* Check if the requested window overlapps with current windows */ - if (MV_TRUE == ethWinOverlapDetect(port, winNum, &pAddrDecWin->addrWin)) - { - mvOsPrintf("mvEthWinSet: ERR. Window %d overlap\n", winNum); - return MV_ERROR; - } - - /* check if address is aligned to the size */ - if(MV_IS_NOT_ALIGN(pAddrDecWin->addrWin.baseLow, pAddrDecWin->addrWin.size)) - { - mvOsPrintf("mvEthWinSet: Error setting Ethernet window %d to "\ - "target %s.\nAddress 0x%08x is unaligned to size 0x%x.\n", - winNum, - mvCtrlTargetNameGet(pAddrDecWin->target), - pAddrDecWin->addrWin.baseLow, - pAddrDecWin->addrWin.size); - return MV_ERROR; - } - - - decRegs.baseReg = MV_REG_READ(ETH_WIN_BASE_REG(port, winNum)); - decRegs.sizeReg = MV_REG_READ(ETH_WIN_SIZE_REG(port, winNum)); - - if (MV_OK != mvCtrlAddrDecToReg(&(pAddrDecWin->addrWin),&decRegs)) - { - mvOsPrintf("mvEthWinSet:mvCtrlAddrDecToReg Failed\n"); - return MV_ERROR; - } - - mvCtrlAttribGet(pAddrDecWin->target,&targetAttribs); - - /* set attributes */ - decRegs.baseReg &= ~ETH_WIN_ATTR_MASK; - decRegs.baseReg |= targetAttribs.attrib << ETH_WIN_ATTR_OFFS; - /* set target ID */ - decRegs.baseReg &= ~ETH_WIN_TARGET_MASK; - decRegs.baseReg |= targetAttribs.targetId << ETH_WIN_TARGET_OFFS; - - /* for the safe side we disable the window before writing the new - values */ - mvEthWinEnable(port, winNum, MV_FALSE); - MV_REG_WRITE(ETH_WIN_BASE_REG(port, winNum), decRegs.baseReg); - - /* Write to address decode Size Register */ - MV_REG_WRITE(ETH_WIN_SIZE_REG(port, winNum), decRegs.sizeReg); - - /* Enable address decode target window */ - if (pAddrDecWin->enable == MV_TRUE) - { - mvEthWinEnable(port, winNum, MV_TRUE); - } - - return MV_OK; -} - -/******************************************************************************* -* mvETHWinGet - Get dma peripheral target address window. -* -* DESCRIPTION: -* Get ETH peripheral target address window. -* -* INPUT: -* winNum - ETH to target address decode window number. -* -* OUTPUT: -* pAddrDecWin - ETH target window data structure. -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvEthWinGet(int port, MV_U32 winNum, MV_ETH_DEC_WIN *pAddrDecWin) -{ - MV_DEC_REGS decRegs; - MV_TARGET_ATTRIB targetAttrib; - - /* Parameter checking */ - if (winNum >= ETH_MAX_DECODE_WIN) - { - mvOsPrintf("mvEthWinGet: ERR. Invalid winNum %d\n", winNum); - return MV_NOT_SUPPORTED; - } - - decRegs.baseReg = MV_REG_READ(ETH_WIN_BASE_REG(port, winNum)); - decRegs.sizeReg = MV_REG_READ(ETH_WIN_SIZE_REG(port, winNum)); - - if (MV_OK != mvCtrlRegToAddrDec(&decRegs,&(pAddrDecWin->addrWin))) - { - mvOsPrintf("mvAhbToMbusWinGet: mvCtrlRegToAddrDec Failed \n"); - return MV_ERROR; - } - - /* attrib and targetId */ - targetAttrib.attrib = - (decRegs.baseReg & ETH_WIN_ATTR_MASK) >> ETH_WIN_ATTR_OFFS; - targetAttrib.targetId = - (decRegs.baseReg & ETH_WIN_TARGET_MASK) >> ETH_WIN_TARGET_OFFS; - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - /* Check if window is enabled */ - if (~(MV_REG_READ(ETH_BASE_ADDR_ENABLE_REG(port))) & (1 << winNum) ) - { - pAddrDecWin->enable = MV_TRUE; - } - else - { - pAddrDecWin->enable = MV_FALSE; - } - - return MV_OK; -} - -/******************************************************************************* -* mvEthWinEnable - Enable/disable a ETH to target address window -* -* DESCRIPTION: -* This function enable/disable a ETH to target address window. -* According to parameter 'enable' the routine will enable the -* window, thus enabling ETH accesses (before enabling the window it is -* tested for overlapping). Otherwise, the window will be disabled. -* -* INPUT: -* winNum - ETH to target address decode window number. -* enable - Enable/disable parameter. -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_ERROR if decode window number was wrong or enabled window overlapps. -* -*******************************************************************************/ -MV_STATUS mvEthWinEnable(int port, MV_U32 winNum,MV_BOOL enable) -{ - MV_ETH_DEC_WIN addrDecWin; - - /* Parameter checking */ - if (winNum >= ETH_MAX_DECODE_WIN) - { - mvOsPrintf("mvEthTargetWinEnable:ERR. Invalid winNum%d\n",winNum); - return MV_ERROR; - } - - if (enable == MV_TRUE) - { /* First check for overlap with other enabled windows */ - /* Get current window */ - if (MV_OK != mvEthWinGet(port, winNum, &addrDecWin)) - { - mvOsPrintf("mvEthTargetWinEnable:ERR. targetWinGet fail\n"); - return MV_ERROR; - } - /* Check for overlapping */ - if (MV_FALSE == ethWinOverlapDetect(port, winNum, &(addrDecWin.addrWin))) - { - /* No Overlap. Enable address decode target window */ - MV_REG_BIT_RESET(ETH_BASE_ADDR_ENABLE_REG(port), (1 << winNum)); - } - else - { /* Overlap detected */ - mvOsPrintf("mvEthTargetWinEnable:ERR. Overlap detected\n"); - return MV_ERROR; - } - } - else - { /* Disable address decode target window */ - MV_REG_BIT_SET(ETH_BASE_ADDR_ENABLE_REG(port), (1 << winNum)); - } - return MV_OK; -} - -/******************************************************************************* -* mvEthWinTargetGet - Get Window number associated with target -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -* window number -* -*******************************************************************************/ -MV_U32 mvEthWinTargetGet(int port, MV_TARGET target) -{ - MV_ETH_DEC_WIN decWin; - MV_U32 winNum; - - /* Check parameters */ - if (target >= MAX_TARGETS) - { - mvOsPrintf("mvAhbToMbusWinTargetGet: target %d is Illigal\n", target); - return 0xffffffff; - } - - for (winNum=0; winNum<ETH_MAX_DECODE_WIN; winNum++) - { - if (mvEthWinGet(port, winNum,&decWin) != MV_OK) - { - mvOsPrintf("mvAhbToMbusWinTargetGet: window returned error\n"); - return 0xffffffff; - } - - if (decWin.enable == MV_TRUE) - { - if (decWin.target == target) - { - return winNum; - } - } - } - return 0xFFFFFFFF; -} - -/******************************************************************************* -* mvEthProtWinSet - Set access protection of Ethernet to target window. -* -* DESCRIPTION: -* Each Ethernet port can be configured with access attributes for each -* of the Ethenret to target windows (address decode windows). This -* function sets access attributes to a given window for the given channel. -* -* INPUTS: -* ethPort - ETH channel number. See MV_ETH_CHANNEL enumerator. -* winNum - IETH to target address decode window number. -* access - IETH access rights. See MV_ACCESS_RIGHTS enumerator. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR in case window number is invalid or access right reserved. -* -*******************************************************************************/ -MV_STATUS mvEthProtWinSet(MV_U32 portNo, MV_U32 winNum, MV_ACCESS_RIGHTS access) -{ - MV_U32 protReg; - - /* Parameter checking */ - if(portNo >= mvCtrlEthMaxPortGet()) - { - mvOsPrintf("mvEthProtWinSet:ERR. Invalid port number %d\n", portNo); - return MV_ERROR; - } - - if (winNum >= ETH_MAX_DECODE_WIN) - { - mvOsPrintf("mvEthProtWinSet:ERR. Invalid winNum%d\n",winNum); - return MV_ERROR; - } - - if((access == ACC_RESERVED) || (access >= MAX_ACC_RIGHTS)) - { - mvOsPrintf("mvEthProtWinSet:ERR. Inv access param %d\n", access); - return MV_ERROR; - } - /* Read current protection register */ - protReg = MV_REG_READ(ETH_ACCESS_PROTECT_REG(portNo)); - - /* Clear protection window field */ - protReg &= ~(ETH_PROT_WIN_MASK(winNum)); - - /* Set new protection field value */ - protReg |= (access << (ETH_PROT_WIN_OFFS(winNum))); - - /* Write protection register back */ - MV_REG_WRITE(ETH_ACCESS_PROTECT_REG(portNo), protReg); - - return MV_OK; -} - -/******************************************************************************* -* ethWinOverlapDetect - Detect ETH address windows overlapping -* -* DESCRIPTION: -* An unpredicted behaviur is expected in case ETH address decode -* windows overlapps. -* This function detects ETH address decode windows overlapping of a -* specified window. The function does not check the window itself for -* overlapping. The function also skipps disabled address decode windows. -* -* INPUT: -* winNum - address decode window number. -* pAddrDecWin - An address decode window struct. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data -* from registers. -* -*******************************************************************************/ -static MV_STATUS ethWinOverlapDetect(int port, MV_U32 winNum, MV_ADDR_WIN *pAddrWin) -{ - MV_U32 baseAddrEnableReg; - MV_U32 winNumIndex; - MV_ETH_DEC_WIN addrDecWin; - - /* Read base address enable register. Do not check disabled windows */ - baseAddrEnableReg = MV_REG_READ(ETH_BASE_ADDR_ENABLE_REG(port)); - - for (winNumIndex=0; winNumIndex<ETH_MAX_DECODE_WIN; winNumIndex++) - { - /* Do not check window itself */ - if (winNumIndex == winNum) - { - continue; - } - - /* Do not check disabled windows */ - if (baseAddrEnableReg & (1 << winNumIndex)) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvEthWinGet(port, winNumIndex, &addrDecWin)) - { - mvOsPrintf("ethWinOverlapDetect: ERR. TargetWinGet failed\n"); - return MV_ERROR; - } -/* - mvOsPrintf("ethWinOverlapDetect:\n - winNumIndex =%d baseHigh =0x%x baseLow=0x%x size=0x%x enable=0x%x\n", - winNumIndex, - addrDecWin.addrWin.baseHigh, - addrDecWin.addrWin.baseLow, - addrDecWin.addrWin.size, - addrDecWin.enable); -*/ - if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin))) - { - return MV_TRUE; - } - } - return MV_FALSE; -} - -/******************************************************************************* -* mvEthAddrDecShow - Print the Etherent address decode map. -* -* DESCRIPTION: -* This function print the Etherent address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -void mvEthPortAddrDecShow(int port) -{ - MV_ETH_DEC_WIN win; - int i; - - mvOsOutput( "\n" ); - mvOsOutput( "ETH %d:\n", port ); - mvOsOutput( "----\n" ); - - for( i = 0; i < ETH_MAX_DECODE_WIN; i++ ) - { - memset( &win, 0, sizeof(ETH_MAX_DECODE_WIN) ); - - mvOsOutput( "win%d - ", i ); - - if( mvEthWinGet(port, i, &win ) == MV_OK ) - { - if( win.enable ) - { - mvOsOutput( "%s base %08x, ", - mvCtrlTargetNameGet(win.target), win.addrWin.baseLow ); - mvOsOutput( "...." ); - mvSizePrint( win.addrWin.size ); - - mvOsOutput( "\n" ); - } - else - mvOsOutput( "disable\n" ); - } - } - return; -} - -void mvEthAddrDecShow(void) -{ - int port; - - for(port=0; port<mvCtrlEthMaxPortGet(); port++) - { - if (MV_FALSE == mvCtrlPwrClckGet(ETH_GIG_UNIT_ID, port)) continue; - - mvEthPortAddrDecShow(port); - } -} - - -void mvEthInit(void) -{ - MV_U32 port; - - /* Power down all existing ports */ - for(port=0; port<mvCtrlEthMaxPortGet(); port++) - { - if (MV_FALSE == mvCtrlPwrClckGet(ETH_GIG_UNIT_ID, port)) - continue; - - mvEthPortPowerUp(port); - mvEthWinInit(port); - } - mvEthHalInit(); -} diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysGbe.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysGbe.h deleted file mode 100644 index 615af512d3..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysGbe.h +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCmvSysGbeh -#define __INCmvSysGbeh - -#include "mvCommon.h" -#include "eth/mvEth.h" -#include "ctrlEnv/mvCtrlEnvSpec.h" -#include "ctrlEnv/sys/mvCpuIf.h" - -#define ETH_WIN_BASE_REG(port, win) (MV_ETH_REG_BASE(port) + 0x200 + ((win)<<3)) -#define ETH_WIN_SIZE_REG(port, win) (MV_ETH_REG_BASE(port) + 0x204 + ((win)<<3)) -#define ETH_WIN_REMAP_REG(port, win) (MV_ETH_REG_BASE(port) + 0x280 + ((win)<<2)) -#define ETH_BASE_ADDR_ENABLE_REG(port) (MV_ETH_REG_BASE(port) + 0x290) -#define ETH_ACCESS_PROTECT_REG(port) (MV_ETH_REG_BASE(port) + 0x294) - -/**** Address decode parameters ****/ - -/* Ethernet Base Address Register bits */ -#define ETH_MAX_DECODE_WIN 6 -#define ETH_MAX_HIGH_ADDR_REMAP_WIN 4 - -/* Ethernet Port Access Protect (EPAP) register */ - -/* The target associated with this window*/ -#define ETH_WIN_TARGET_OFFS 0 -#define ETH_WIN_TARGET_MASK (0xf << ETH_WIN_TARGET_OFFS) -/* The target attributes Associated with window */ -#define ETH_WIN_ATTR_OFFS 8 -#define ETH_WIN_ATTR_MASK (0xff << ETH_WIN_ATTR_OFFS) - -/* Ethernet Port Access Protect Register (EPAPR) */ -#define ETH_PROT_NO_ACCESS NO_ACCESS_ALLOWED -#define ETH_PROT_READ_ONLY READ_ONLY -#define ETH_PROT_FULL_ACCESS FULL_ACCESS -#define ETH_PROT_WIN_OFFS(winNum) (2 * (winNum)) -#define ETH_PROT_WIN_MASK(winNum) (0x3 << ETH_PROT_WIN_OFFS(winNum)) - -MV_STATUS mvEthWinInit (int port); -MV_STATUS mvEthWinEnable(int port, MV_U32 winNum, MV_BOOL enable); -MV_U32 mvEthWinTargetGet(int port, MV_TARGET target); -MV_STATUS mvEthProtWinSet(MV_U32 portNo, MV_U32 winNum, MV_ACCESS_RIGHTS - access); - -void mvEthPortAddrDecShow(int port); - -MV_VOID mvEthAddrDecShow(MV_VOID); - -void mvEthInit(void); - -#endif diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysPex.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysPex.c deleted file mode 100644 index b0cb466ab3..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysPex.c +++ /dev/null @@ -1,1697 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include "ctrlEnv/sys/mvSysPex.h" - -/* this structure describes the mapping between a Pex Window and a CPU target*/ -typedef struct _pexWinToTarget -{ - MV_TARGET target; - MV_BOOL enable; - -}PEX_WIN_TO_TARGET; - -/* this array is a priority array that define How Pex windows should be -configured , We have only 6 Pex Windows that can be configured , but we -have maximum of 9 CPU target windows ! the following array is a priority -array where the lowest index has the highest priotiy and the highest -index has the lowest priority of being cnfigured */ - -MV_U32 pexDevBarPrioTable[] = -{ -#if defined(MV_INCLUDE_DEVICE_CS0) - DEVICE_CS0, -#endif -#if defined(MV_INCLUDE_DEVICE_CS1) - DEVICE_CS1, -#endif -#if defined(MV_INCLUDE_DEVICE_CS2) - DEVICE_CS2, -#endif -#if defined(MV_INCLUDE_DEVICE_CS3) - DEVICE_CS3, -#endif -/* -#if defined(MV_INCLUDE_DEVICE_CS4) - DEVICE_CS4, -#endif -*/ - TBL_TERM -}; - - -/* PEX Wins registers offsets are inconsecutive. This struct describes WIN */ -/* register offsets and its function where its is located. */ -/* Also, PEX address remap registers offsets are inconsecutive. This struct */ -/* describes address remap register offsets */ -typedef struct _pexWinRegInfo -{ - MV_U32 baseLowRegOffs; - MV_U32 baseHighRegOffs; - MV_U32 sizeRegOffs; - MV_U32 remapLowRegOffs; - MV_U32 remapHighRegOffs; - -}PEX_WIN_REG_INFO; - -static MV_STATUS pexWinOverlapDetect(MV_U32 pexIf, MV_U32 winNum, - MV_ADDR_WIN *pAddrWin); -static MV_STATUS pexWinRegInfoGet(MV_U32 pexIf, MV_U32 winNum, - PEX_WIN_REG_INFO *pWinRegInfo); - -static MV_STATUS pexBarIsValid(MV_U32 baseLow, MV_U32 size); - -static MV_BOOL pexIsWinWithinBar(MV_U32 pexIf,MV_ADDR_WIN *pAddrWin); -static MV_BOOL pexBarOverlapDetect(MV_U32 pexIf,MV_U32 barNum, - MV_ADDR_WIN *pAddrWin); -const MV_8* pexBarNameGet( MV_U32 bar ); - - -/******************************************************************************* -* mvPexInit - Initialize PEX interfaces -* -* DESCRIPTION: -* -* This function is responsible of intialization of the Pex Interface , It -* configure the Pex Bars and Windows in the following manner: -* -* Assumptions : -* Bar0 is always internal registers bar -* Bar1 is always the DRAM bar -* Bar2 is always the Device bar -* -* 1) Sets the Internal registers bar base by obtaining the base from -* the CPU Interface -* 2) Sets the DRAM bar base and size by getting the base and size from -* the CPU Interface when the size is the sum of all enabled DRAM -* chip selects and the base is the base of CS0 . -* 3) Sets the Device bar base and size by getting these values from the -* CPU Interface when the base is the base of the lowest base of the -* Device chip selects, and the -* -* -* INPUT: -* -* pexIf - PEX interface number. -* -* -* OUTPUT: -* None. -* -* RETURN: -* MV_OK if function success otherwise MV_ERROR or MV_BAD_PARAM -* -*******************************************************************************/ -MV_STATUS mvPexInit(MV_U32 pexIf, MV_PEX_TYPE pexType) -{ - MV_U32 bar; - MV_U32 winNum; - MV_PEX_BAR pexBar; - MV_PEX_DEC_WIN pexWin; - MV_CPU_DEC_WIN addrDecWin; - MV_TARGET target; - MV_U32 pexCurrWin=0; - MV_U32 status; - /* default and exapntion rom - are always configured */ - -#ifndef MV_DISABLE_PEX_DEVICE_BAR - MV_U32 winIndex; - MV_U32 maxBase=0, sizeOfMaxBase=0; - MV_U32 pexStartWindow; -#endif - - /* Parameter checking */ - if(pexIf >= mvCtrlPexMaxIfGet()) - { - mvOsPrintf("mvPexInit: ERR. Invalid PEX interface %d\n", pexIf); - return MV_BAD_PARAM; - } - - /* Enabled CPU access to PCI-Express */ - mvCpuIfEnablePex(pexIf, pexType); - - /* Start with bars */ - /* First disable all PEX bars*/ - for (bar = 0; bar < PEX_MAX_BARS; bar++) - { - if (PEX_INTER_REGS_BAR != bar) - { - if (MV_OK != mvPexBarEnable(pexIf, bar, MV_FALSE)) - { - mvOsPrintf("mvPexInit:mvPexBarEnable bar =%d failed \n",bar); - return MV_ERROR; - } - - } - - } - - /* and disable all PEX target windows */ - for (winNum = 0; winNum < PEX_MAX_TARGET_WIN - 2; winNum++) - { - if (MV_OK != mvPexTargetWinEnable(pexIf, winNum, MV_FALSE)) - { - mvOsPrintf("mvPexInit:mvPexTargetWinEnable winNum =%d failed \n", - winNum); - return MV_ERROR; - - } - } - - /* Now, go through all bars*/ - - - -/******************************************************************************/ -/* Internal registers bar */ -/******************************************************************************/ - bar = PEX_INTER_REGS_BAR; - - /* we only open the bar , no need to open windows for this bar */ - - /* first get the CS attribute from the CPU Interface */ - if (MV_OK !=mvCpuIfTargetWinGet(INTER_REGS,&addrDecWin)) - { - mvOsPrintf("mvPexInit: ERR. mvCpuIfTargetWinGet failed target =%d\n",INTER_REGS); - return MV_ERROR; - } - - pexBar.addrWin.baseHigh = addrDecWin.addrWin.baseHigh; - pexBar.addrWin.baseLow = addrDecWin.addrWin.baseLow; - pexBar.addrWin.size = addrDecWin.addrWin.size; - pexBar.enable = MV_TRUE; - - if (MV_OK != mvPexBarSet(pexIf, bar, &pexBar)) - { - mvOsPrintf("mvPexInit: ERR. mvPexBarSet %d failed\n", bar); - return MV_ERROR; - } - -/******************************************************************************/ -/* DRAM bar */ -/******************************************************************************/ - - bar = PEX_DRAM_BAR; - - pexBar.addrWin.size = 0; - - for (target = SDRAM_CS0;target < MV_DRAM_MAX_CS; target++ ) - { - - status = mvCpuIfTargetWinGet(target,&addrDecWin); - - if((MV_NO_SUCH == status)&&(target != SDRAM_CS0)) - { - continue; - } - - /* first get attributes from CPU If */ - if (MV_OK != status) - { - mvOsPrintf("mvPexInit: ERR. mvCpuIfTargetWinGet failed target =%d\n",target); - return MV_ERROR; - } - if (addrDecWin.enable == MV_TRUE) - { - /* the base is the base of DRAM CS0 always */ - if (SDRAM_CS0 == target ) - { - pexBar.addrWin.baseHigh = addrDecWin.addrWin.baseHigh; - pexBar.addrWin.baseLow = addrDecWin.addrWin.baseLow; - - } - - /* increment the bar size to be the sum of the size of all - DRAM chips selecs */ - pexBar.addrWin.size += addrDecWin.addrWin.size; - - /* set a Pex window for this target ! - DRAM CS always will have a Pex Window , and is not a - part of the priority table */ - pexWin.addrWin.baseHigh = addrDecWin.addrWin.baseHigh; - pexWin.addrWin.baseLow = addrDecWin.addrWin.baseLow; - pexWin.addrWin.size = addrDecWin.addrWin.size; - - /* we disable the windows at first because we are not - sure that it is witihin bar boundries */ - pexWin.enable =MV_FALSE; - pexWin.target = target; - pexWin.targetBar = bar; - - if (MV_OK != mvPexTargetWinSet(pexIf,pexCurrWin++,&pexWin)) - { - mvOsPrintf("mvPexInit: ERR. mvPexTargetWinSet failed\n"); - return MV_ERROR; - } - } - } - - /* check if the size of the bar is illeggal */ - if (-1 == ctrlSizeToReg(pexBar.addrWin.size, PXBCR_BAR_SIZE_ALIGNMENT)) - { - /* try to get a good size */ - pexBar.addrWin.size = ctrlSizeRegRoundUp(pexBar.addrWin.size, - PXBCR_BAR_SIZE_ALIGNMENT); - } - - /* check if the size and base are valid */ - if (MV_TRUE == pexBarOverlapDetect(pexIf,bar,&pexBar.addrWin)) - { - mvOsPrintf("mvPexInit:Warning :Bar %d size is illigal\n",bar); - mvOsPrintf("it will be disabled\n"); - mvOsPrintf("please check Pex and CPU windows configuration\n"); - } - else - { - pexBar.enable = MV_TRUE; - - /* configure the bar */ - if (MV_OK != mvPexBarSet(pexIf, bar, &pexBar)) - { - mvOsPrintf("mvPexInit: ERR. mvPexBarSet %d failed\n", bar); - return MV_ERROR; - } - - /* after the bar was configured then we enable the Pex windows*/ - for (winNum = 0;winNum < pexCurrWin ;winNum++) - { - if (MV_OK != mvPexTargetWinEnable(pexIf, winNum, MV_TRUE)) - { - mvOsPrintf("mvPexInit: Can't enable window =%d\n",winNum); - return MV_ERROR; - } - - } - } - -/******************************************************************************/ -/* DEVICE bar */ -/******************************************************************************/ - -/* Open the Device BAR for non linux only */ -#ifndef MV_DISABLE_PEX_DEVICE_BAR - - /* then device bar*/ - bar = PEX_DEVICE_BAR; - - /* save the starting window */ - pexStartWindow = pexCurrWin; - pexBar.addrWin.size = 0; - pexBar.addrWin.baseLow = 0xffffffff; - pexBar.addrWin.baseHigh = 0; - maxBase = 0; - - for (target = DEV_TO_TARGET(START_DEV_CS);target < DEV_TO_TARGET(MV_DEV_MAX_CS); target++ ) - { - status = mvCpuIfTargetWinGet(target,&addrDecWin); - - if (MV_NO_SUCH == status) - { - continue; - } - - if (MV_OK != status) - { - mvOsPrintf("mvPexInit: ERR. mvCpuIfTargetWinGet failed target =%d\n",target); - return MV_ERROR; - } - - if (addrDecWin.enable == MV_TRUE) - { - /* get the minimum base */ - if (addrDecWin.addrWin.baseLow < pexBar.addrWin.baseLow) - { - pexBar.addrWin.baseLow = addrDecWin.addrWin.baseLow; - } - - /* get the maximum base */ - if (addrDecWin.addrWin.baseLow > maxBase) - { - maxBase = addrDecWin.addrWin.baseLow; - sizeOfMaxBase = addrDecWin.addrWin.size; - } - - /* search in the priority table for this target */ - for (winIndex = 0; pexDevBarPrioTable[winIndex] != TBL_TERM; - winIndex++) - { - if (pexDevBarPrioTable[winIndex] != target) - { - continue; - } - else if (pexDevBarPrioTable[winIndex] == target) - { - /*found it */ - - /* if the index of this target in the prio table is valid - then we set the Pex window for this target, a valid index is - an index that is lower than the number of the windows that - was not configured yet */ - - /* we subtract 2 always because the default and expantion - rom windows are always configured */ - if ( pexCurrWin < PEX_MAX_TARGET_WIN - 2) - { - /* set a Pex window for this target ! */ - pexWin.addrWin.baseHigh = addrDecWin.addrWin.baseHigh; - pexWin.addrWin.baseLow = addrDecWin.addrWin.baseLow; - pexWin.addrWin.size = addrDecWin.addrWin.size; - - /* we disable the windows at first because we are not - sure that it is witihin bar boundries */ - pexWin.enable = MV_FALSE; - pexWin.target = target; - pexWin.targetBar = bar; - - if (MV_OK != mvPexTargetWinSet(pexIf,pexCurrWin++, - &pexWin)) - { - mvOsPrintf("mvPexInit: ERR. Window Set failed\n"); - return MV_ERROR; - } - } - } - } - } - } - - pexBar.addrWin.size = maxBase - pexBar.addrWin.baseLow + sizeOfMaxBase; - pexBar.enable = MV_TRUE; - - /* check if the size of the bar is illegal */ - if (-1 == ctrlSizeToReg(pexBar.addrWin.size, PXBCR_BAR_SIZE_ALIGNMENT)) - { - /* try to get a good size */ - pexBar.addrWin.size = ctrlSizeRegRoundUp(pexBar.addrWin.size, - PXBCR_BAR_SIZE_ALIGNMENT); - } - - /* check if the size and base are valid */ - if (MV_TRUE == pexBarOverlapDetect(pexIf,bar,&pexBar.addrWin)) - { - mvOsPrintf("mvPexInit:Warning :Bar %d size is illigal\n",bar); - mvOsPrintf("it will be disabled\n"); - mvOsPrintf("please check Pex and CPU windows configuration\n"); - } - else - { - if (MV_OK != mvPexBarSet(pexIf, bar, &pexBar)) - { - mvOsPrintf("mvPexInit: ERR. mvPexBarSet %d failed\n", bar); - return MV_ERROR; - } - - /* now enable the windows */ - for (winNum = pexStartWindow; winNum < pexCurrWin ; winNum++) - { - if (MV_OK != mvPexTargetWinEnable(pexIf, winNum, MV_TRUE)) - { - mvOsPrintf("mvPexInit:mvPexTargetWinEnable winNum =%d failed \n", - winNum); - return MV_ERROR; - } - } - } - -#endif - - return mvPexHalInit(pexIf, pexType); - -} - -/******************************************************************************* -* mvPexTargetWinSet - Set PEX to peripheral target address window BAR -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_OK if PEX BAR target window was set correctly, -* MV_BAD_PARAM on bad params -* MV_ERROR otherwise -* (e.g. address window overlapps with other active PEX target window). -* -*******************************************************************************/ -MV_STATUS mvPexTargetWinSet(MV_U32 pexIf, MV_U32 winNum, - MV_PEX_DEC_WIN *pAddrDecWin) -{ - - MV_DEC_REGS decRegs; - PEX_WIN_REG_INFO winRegInfo; - MV_TARGET_ATTRIB targetAttribs; - - /* Parameter checking */ - if(pexIf >= mvCtrlPexMaxIfGet()) - { - mvOsPrintf("mvPexTargetWinSet: ERR. Invalid PEX interface %d\n", pexIf); - return MV_BAD_PARAM; - } - - if (winNum >= PEX_MAX_TARGET_WIN) - { - mvOsPrintf("mvPexTargetWinSet: ERR. Invalid PEX winNum %d\n", winNum); - return MV_BAD_PARAM; - - } - - /* get the pex Window registers offsets */ - pexWinRegInfoGet(pexIf,winNum,&winRegInfo); - - - if (MV_TRUE == pAddrDecWin->enable) - { - - /* 2) Check if the requested window overlaps with current windows */ - if (MV_TRUE == pexWinOverlapDetect(pexIf,winNum, &pAddrDecWin->addrWin)) - { - mvOsPrintf("mvPexTargetWinSet: ERR. Target %d overlap\n", winNum); - return MV_BAD_PARAM; - } - - /* 2) Check if the requested window overlaps with current windows */ - if (MV_FALSE == pexIsWinWithinBar(pexIf,&pAddrDecWin->addrWin)) - { - mvOsPrintf("mvPexTargetWinSet: Win %d should be in bar boundries\n", - winNum); - return MV_BAD_PARAM; - } - - } - - - - /* read base register*/ - - if (winRegInfo.baseLowRegOffs) - { - decRegs.baseReg = MV_REG_READ(winRegInfo.baseLowRegOffs); - } - else - { - decRegs.baseReg = 0; - } - - if (winRegInfo.sizeRegOffs) - { - decRegs.sizeReg = MV_REG_READ(winRegInfo.sizeRegOffs); - } - else - { - decRegs.sizeReg =0; - } - - if (MV_OK != mvCtrlAddrDecToReg(&(pAddrDecWin->addrWin),&decRegs)) - { - mvOsPrintf("mvPexTargetWinSet:mvCtrlAddrDecToReg Failed\n"); - return MV_ERROR; - } - - /* enable\Disable */ - if (MV_TRUE == pAddrDecWin->enable) - { - decRegs.sizeReg |= PXWCR_WIN_EN; - } - else - { - decRegs.sizeReg &= ~PXWCR_WIN_EN; - } - - - /* clear bit location */ - decRegs.sizeReg &= ~PXWCR_WIN_BAR_MAP_MASK; - - /* set bar Mapping */ - if (pAddrDecWin->targetBar == 1) - { - decRegs.sizeReg |= PXWCR_WIN_BAR_MAP_BAR1; - } - else if (pAddrDecWin->targetBar == 2) - { - decRegs.sizeReg |= PXWCR_WIN_BAR_MAP_BAR2; - } - - mvCtrlAttribGet(pAddrDecWin->target,&targetAttribs); - - /* set attributes */ - decRegs.sizeReg &= ~PXWCR_ATTRIB_MASK; - decRegs.sizeReg |= targetAttribs.attrib << PXWCR_ATTRIB_OFFS; - /* set target ID */ - decRegs.sizeReg &= ~PXWCR_TARGET_MASK; - decRegs.sizeReg |= targetAttribs.targetId << PXWCR_TARGET_OFFS; - - - /* 3) Write to address decode Base Address Register */ - - if (winRegInfo.baseLowRegOffs) - { - MV_REG_WRITE(winRegInfo.baseLowRegOffs, decRegs.baseReg); - } - - /* write size reg */ - if (winRegInfo.sizeRegOffs) - { - if ((MV_PEX_WIN_DEFAULT == winNum)|| - (MV_PEX_WIN_EXP_ROM == winNum)) - { - /* clear size because there is no size field*/ - decRegs.sizeReg &= ~PXWCR_SIZE_MASK; - - /* clear enable because there is no enable field*/ - decRegs.sizeReg &= ~PXWCR_WIN_EN; - - } - - MV_REG_WRITE(winRegInfo.sizeRegOffs, decRegs.sizeReg); - } - - - return MV_OK; - -} - -/******************************************************************************* -* mvPexTargetWinGet - Get PEX to peripheral target address window -* -* DESCRIPTION: -* Get the PEX to peripheral target address window BAR. -* -* INPUT: -* pexIf - PEX interface number. -* bar - BAR to be accessed by slave. -* -* OUTPUT: -* pAddrBarWin - PEX target window information data structure. -* -* RETURN: -* MV_BAD_PARAM for bad parameters ,MV_ERROR on error ! otherwise MV_OK -* -*******************************************************************************/ -MV_STATUS mvPexTargetWinGet(MV_U32 pexIf, MV_U32 winNum, - MV_PEX_DEC_WIN *pAddrDecWin) -{ - MV_TARGET_ATTRIB targetAttrib; - MV_DEC_REGS decRegs; - - PEX_WIN_REG_INFO winRegInfo; - - /* Parameter checking */ - if(pexIf >= mvCtrlPexMaxIfGet()) - { - mvOsPrintf("mvPexTargetWinGet: ERR. Invalid PEX interface %d\n", pexIf); - return MV_BAD_PARAM; - } - - if (winNum >= PEX_MAX_TARGET_WIN) - { - mvOsPrintf("mvPexTargetWinGet: ERR. Invalid PEX winNum %d\n", winNum); - return MV_BAD_PARAM; - - } - - /* get the pex Window registers offsets */ - pexWinRegInfoGet(pexIf,winNum,&winRegInfo); - - /* read base register*/ - if (winRegInfo.baseLowRegOffs) - { - decRegs.baseReg = MV_REG_READ(winRegInfo.baseLowRegOffs); - } - else - { - decRegs.baseReg = 0; - } - - /* read size reg */ - if (winRegInfo.sizeRegOffs) - { - decRegs.sizeReg = MV_REG_READ(winRegInfo.sizeRegOffs); - } - else - { - decRegs.sizeReg =0; - } - - if (MV_OK != mvCtrlRegToAddrDec(&decRegs,&(pAddrDecWin->addrWin))) - { - mvOsPrintf("mvPexTargetWinGet: mvCtrlRegToAddrDec Failed \n"); - return MV_ERROR; - - } - - if (decRegs.sizeReg & PXWCR_WIN_EN) - { - pAddrDecWin->enable = MV_TRUE; - } - else - { - pAddrDecWin->enable = MV_FALSE; - - } - - - #if 0 - if (-1 == pAddrDecWin->addrWin.size) - { - return MV_ERROR; - } - #endif - - - /* get target bar */ - if ((decRegs.sizeReg & PXWCR_WIN_BAR_MAP_MASK) == PXWCR_WIN_BAR_MAP_BAR1 ) - { - pAddrDecWin->targetBar = 1; - } - else if ((decRegs.sizeReg & PXWCR_WIN_BAR_MAP_MASK) == - PXWCR_WIN_BAR_MAP_BAR2 ) - { - pAddrDecWin->targetBar = 2; - } - - /* attrib and targetId */ - pAddrDecWin->attrib = (decRegs.sizeReg & PXWCR_ATTRIB_MASK) >> - PXWCR_ATTRIB_OFFS; - pAddrDecWin->targetId = (decRegs.sizeReg & PXWCR_TARGET_MASK) >> - PXWCR_TARGET_OFFS; - - targetAttrib.attrib = pAddrDecWin->attrib; - targetAttrib.targetId = pAddrDecWin->targetId; - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - return MV_OK; - -} - - -/******************************************************************************* -* mvPexTargetWinEnable - Enable/disable a PEX BAR window -* -* DESCRIPTION: -* This function enable/disable a PEX BAR window. -* if parameter 'enable' == MV_TRUE the routine will enable the -* window, thus enabling PEX accesses for that BAR (before enabling the -* window it is tested for overlapping). Otherwise, the window will -* be disabled. -* -* INPUT: -* pexIf - PEX interface number. -* bar - BAR to be accessed by slave. -* enable - Enable/disable parameter. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM for bad parameters ,MV_ERROR on error ! otherwise MV_OK -* -*******************************************************************************/ -MV_STATUS mvPexTargetWinEnable(MV_U32 pexIf,MV_U32 winNum, MV_BOOL enable) -{ - PEX_WIN_REG_INFO winRegInfo; - MV_PEX_DEC_WIN addrDecWin; - - /* Parameter checking */ - if(pexIf >= mvCtrlPexMaxIfGet()) - { - mvOsPrintf("mvPexTargetWinEnable: ERR. Invalid PEX If %d\n", pexIf); - return MV_BAD_PARAM; - } - - if (winNum >= PEX_MAX_TARGET_WIN) - { - mvOsPrintf("mvPexTargetWinEnable ERR. Invalid PEX winNum %d\n", winNum); - return MV_BAD_PARAM; - - } - - - /* get the pex Window registers offsets */ - pexWinRegInfoGet(pexIf,winNum,&winRegInfo); - - - /* if the address windows is disabled , we only disable the appropriare - pex window and ignore other settings */ - - if (MV_FALSE == enable) - { - - /* this is not relevant to default and expantion rom - windows */ - if (winRegInfo.sizeRegOffs) - { - if ((MV_PEX_WIN_DEFAULT != winNum)&& - (MV_PEX_WIN_EXP_ROM != winNum)) - { - MV_REG_BIT_RESET(winRegInfo.sizeRegOffs, PXWCR_WIN_EN); - } - } - - } - else - { - if (MV_OK != mvPexTargetWinGet(pexIf,winNum, &addrDecWin)) - { - mvOsPrintf("mvPexTargetWinEnable: mvPexTargetWinGet Failed\n"); - return MV_ERROR; - } - - /* Check if the requested window overlaps with current windows */ - if (MV_TRUE == pexWinOverlapDetect(pexIf,winNum, &addrDecWin.addrWin)) - { - mvOsPrintf("mvPexTargetWinEnable: ERR. Target %d overlap\n", winNum); - return MV_BAD_PARAM; - } - - if (MV_FALSE == pexIsWinWithinBar(pexIf,&addrDecWin.addrWin)) - { - mvOsPrintf("mvPexTargetWinEnable: Win %d should be in bar boundries\n", - winNum); - return MV_BAD_PARAM; - } - - - /* this is not relevant to default and expantion rom - windows */ - if (winRegInfo.sizeRegOffs) - { - if ((MV_PEX_WIN_DEFAULT != winNum)&& - (MV_PEX_WIN_EXP_ROM != winNum)) - { - MV_REG_BIT_SET(winRegInfo.sizeRegOffs, PXWCR_WIN_EN); - } - } - - - } - - return MV_OK; - -} - - - -/******************************************************************************* -* mvPexTargetWinRemap - Set PEX to target address window remap. -* -* DESCRIPTION: -* The PEX interface supports remap of the BAR original address window. -* For each BAR it is possible to define a remap address. For example -* an address 0x12345678 that hits BAR 0x10 (SDRAM CS[0]) will be modified -* according to remap register but will also be targeted to the -* SDRAM CS[0]. -* -* INPUT: -* pexIf - PEX interface number. -* bar - Peripheral target enumerator accessed by slave. -* pAddrWin - Address window to be checked. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM for bad parameters ,MV_ERROR on error ! otherwise MV_OK -* -*******************************************************************************/ -MV_STATUS mvPexTargetWinRemap(MV_U32 pexIf, MV_U32 winNum, - MV_PEX_REMAP_WIN *pAddrWin) -{ - - PEX_WIN_REG_INFO winRegInfo; - - /* Parameter checking */ - if (pexIf >= mvCtrlPexMaxIfGet()) - { - mvOsPrintf("mvPexTargetWinRemap: ERR. Invalid PEX interface num %d\n", - pexIf); - return MV_BAD_PARAM; - } - if (MV_PEX_WIN_DEFAULT == winNum) - { - mvOsPrintf("mvPexTargetWinRemap: ERR. Invalid PEX win num %d\n", - winNum); - return MV_BAD_PARAM; - - } - - if (MV_IS_NOT_ALIGN(pAddrWin->addrWin.baseLow, PXWRR_REMAP_ALIGNMENT)) - { - mvOsPrintf("mvPexTargetWinRemap: Error remap PEX interface %d win %d."\ - "\nAddress 0x%08x is unaligned to size 0x%x.\n", - pexIf, - winNum, - pAddrWin->addrWin.baseLow, - pAddrWin->addrWin.size); - - return MV_ERROR; - } - - pexWinRegInfoGet(pexIf, winNum, &winRegInfo); - - /* Set remap low register value */ - MV_REG_WRITE(winRegInfo.remapLowRegOffs, pAddrWin->addrWin.baseLow); - - /* Skip base high settings if the BAR has only base low (32-bit) */ - if (0 != winRegInfo.remapHighRegOffs) - { - MV_REG_WRITE(winRegInfo.remapHighRegOffs, pAddrWin->addrWin.baseHigh); - } - - - if (pAddrWin->enable == MV_TRUE) - { - MV_REG_BIT_SET(winRegInfo.remapLowRegOffs,PXWRR_REMAP_EN); - } - else - { - MV_REG_BIT_RESET(winRegInfo.remapLowRegOffs,PXWRR_REMAP_EN); - } - - return MV_OK; -} - -/******************************************************************************* -* mvPexTargetWinRemapEnable - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -* MV_BAD_PARAM for bad parameters ,MV_ERROR on error ! otherwise MV_OK -* -*******************************************************************************/ - -MV_STATUS mvPexTargetWinRemapEnable(MV_U32 pexIf, MV_U32 winNum, - MV_BOOL enable) -{ - PEX_WIN_REG_INFO winRegInfo; - - /* Parameter checking */ - if (pexIf >= mvCtrlPexMaxIfGet()) - { - mvOsPrintf("mvPexTargetWinRemap: ERR. Invalid PEX interface num %d\n", - pexIf); - return MV_BAD_PARAM; - } - if (MV_PEX_WIN_DEFAULT == winNum) - { - mvOsPrintf("mvPexTargetWinRemap: ERR. Invalid PEX win num %d\n", - winNum); - return MV_BAD_PARAM; - - } - - - pexWinRegInfoGet(pexIf, winNum, &winRegInfo); - - if (enable == MV_TRUE) - { - MV_REG_BIT_SET(winRegInfo.remapLowRegOffs,PXWRR_REMAP_EN); - } - else - { - MV_REG_BIT_RESET(winRegInfo.remapLowRegOffs,PXWRR_REMAP_EN); - } - - return MV_OK; - -} - -/******************************************************************************* -* mvPexBarSet - Set PEX bar address and size -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM for bad parameters ,MV_ERROR on error ! otherwise MV_OK -* -*******************************************************************************/ -MV_STATUS mvPexBarSet(MV_U32 pexIf, - MV_U32 barNum, - MV_PEX_BAR *pAddrWin) -{ - MV_U32 regBaseLow; - MV_U32 regSize,sizeToReg; - - - /* check parameters */ - if(pexIf >= mvCtrlPexMaxIfGet()) - { - mvOsPrintf("mvPexBarSet: ERR. Invalid PEX interface %d\n", pexIf); - return MV_BAD_PARAM; - } - - if(barNum >= PEX_MAX_BARS) - { - mvOsPrintf("mvPexBarSet: ERR. Invalid bar number %d\n", barNum); - return MV_BAD_PARAM; - } - - - if (pAddrWin->addrWin.size == 0) - { - mvOsPrintf("mvPexBarSet: Size zero is Illigal\n" ); - return MV_BAD_PARAM; - } - - - /* Check if the window complies with PEX spec */ - if (MV_TRUE != pexBarIsValid(pAddrWin->addrWin.baseLow, - pAddrWin->addrWin.size)) - { - mvOsPrintf("mvPexBarSet: ERR. Target %d window invalid\n", barNum); - return MV_BAD_PARAM; - } - - /* 2) Check if the requested bar overlaps with current bars */ - if (MV_TRUE == pexBarOverlapDetect(pexIf,barNum, &pAddrWin->addrWin)) - { - mvOsPrintf("mvPexBarSet: ERR. Target %d overlap\n", barNum); - return MV_BAD_PARAM; - } - - /* Get size register value according to window size */ - sizeToReg = ctrlSizeToReg(pAddrWin->addrWin.size, PXBCR_BAR_SIZE_ALIGNMENT); - - /* Read bar size */ - if (PEX_INTER_REGS_BAR != barNum) /* internal registers have no size */ - { - regSize = MV_REG_READ(PEX_BAR_CTRL_REG(pexIf,barNum)); - - /* Size parameter validity check. */ - if (-1 == sizeToReg) - { - mvOsPrintf("mvPexBarSet: ERR. Target BAR %d size invalid.\n",barNum); - return MV_BAD_PARAM; - } - - regSize &= ~PXBCR_BAR_SIZE_MASK; - regSize |= (sizeToReg << PXBCR_BAR_SIZE_OFFS) ; - - MV_REG_WRITE(PEX_BAR_CTRL_REG(pexIf,barNum),regSize); - - } - - /* set size */ - - - - /* Read base address low */ - regBaseLow = MV_REG_READ(PEX_CFG_DIRECT_ACCESS(pexIf, - PEX_MV_BAR_BASE(barNum))); - - /* clear current base */ - if (PEX_INTER_REGS_BAR == barNum) - { - regBaseLow &= ~PXBIR_BASE_MASK; - regBaseLow |= (pAddrWin->addrWin.baseLow & PXBIR_BASE_MASK); - } - else - { - regBaseLow &= ~PXBR_BASE_MASK; - regBaseLow |= (pAddrWin->addrWin.baseLow & PXBR_BASE_MASK); - } - - /* if we had a previous value that contain the bar type (MeM\IO), we want to - restore it */ - regBaseLow |= PEX_BAR_DEFAULT_ATTRIB; - - - - /* write base low */ - MV_REG_WRITE(PEX_CFG_DIRECT_ACCESS(pexIf,PEX_MV_BAR_BASE(barNum)), - regBaseLow); - - if (pAddrWin->addrWin.baseHigh != 0) - { - /* Read base address high */ - MV_REG_WRITE(PEX_CFG_DIRECT_ACCESS(pexIf,PEX_MV_BAR_BASE_HIGH(barNum)), - pAddrWin->addrWin.baseHigh); - - } - - /* lastly enable the Bar */ - if (pAddrWin->enable == MV_TRUE) - { - if (PEX_INTER_REGS_BAR != barNum) /* internal registers - are enabled always */ - { - MV_REG_BIT_SET(PEX_BAR_CTRL_REG(pexIf,barNum),PXBCR_BAR_EN); - } - } - else if (MV_FALSE == pAddrWin->enable) - { - if (PEX_INTER_REGS_BAR != barNum) /* internal registers - are enabled always */ - { - MV_REG_BIT_RESET(PEX_BAR_CTRL_REG(pexIf,barNum),PXBCR_BAR_EN); - } - - } - - - - return MV_OK; -} - - -/******************************************************************************* -* mvPexBarGet - Get PEX bar address and size -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM for bad parameters ,MV_ERROR on error ! otherwise MV_OK -* -*******************************************************************************/ - -MV_STATUS mvPexBarGet(MV_U32 pexIf, - MV_U32 barNum, - MV_PEX_BAR *pAddrWin) -{ - /* check parameters */ - if(pexIf >= mvCtrlPexMaxIfGet()) - { - mvOsPrintf("mvPexBarGet: ERR. Invalid PEX interface %d\n", pexIf); - return MV_BAD_PARAM; - } - - if(barNum >= PEX_MAX_BARS) - { - mvOsPrintf("mvPexBarGet: ERR. Invalid bar number %d\n", barNum); - return MV_BAD_PARAM; - } - - /* read base low */ - pAddrWin->addrWin.baseLow = - MV_REG_READ(PEX_CFG_DIRECT_ACCESS(pexIf,PEX_MV_BAR_BASE(barNum))); - - - if (PEX_INTER_REGS_BAR == barNum) - { - pAddrWin->addrWin.baseLow &= PXBIR_BASE_MASK; - } - else - { - pAddrWin->addrWin.baseLow &= PXBR_BASE_MASK; - } - - - /* read base high */ - pAddrWin->addrWin.baseHigh = - MV_REG_READ(PEX_CFG_DIRECT_ACCESS(pexIf,PEX_MV_BAR_BASE_HIGH(barNum))); - - - /* Read bar size */ - if (PEX_INTER_REGS_BAR != barNum) /* internal registers have no size */ - { - pAddrWin->addrWin.size = MV_REG_READ(PEX_BAR_CTRL_REG(pexIf,barNum)); - - /* check if enable or not */ - if (pAddrWin->addrWin.size & PXBCR_BAR_EN) - { - pAddrWin->enable = MV_TRUE; - } - else - { - pAddrWin->enable = MV_FALSE; - } - - /* now get the size */ - pAddrWin->addrWin.size &= PXBCR_BAR_SIZE_MASK; - pAddrWin->addrWin.size >>= PXBCR_BAR_SIZE_OFFS; - - pAddrWin->addrWin.size = ctrlRegToSize(pAddrWin->addrWin.size, - PXBCR_BAR_SIZE_ALIGNMENT); - - } - else /* PEX_INTER_REGS_BAR */ - { - pAddrWin->addrWin.size = INTER_REGS_SIZE; - pAddrWin->enable = MV_TRUE; - } - - - return MV_OK; -} - -/******************************************************************************* -* mvPexBarEnable - -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM for bad parameters ,MV_ERROR on error ! otherwise MV_OK -* -*******************************************************************************/ - - -MV_STATUS mvPexBarEnable(MV_U32 pexIf, MV_U32 barNum, MV_BOOL enable) -{ - - MV_PEX_BAR pexBar; - - /* check parameters */ - if(pexIf >= mvCtrlPexMaxIfGet()) - { - mvOsPrintf("mvPexBarEnable: ERR. Invalid PEX interface %d\n", pexIf); - return MV_BAD_PARAM; - } - - - if(barNum >= PEX_MAX_BARS) - { - mvOsPrintf("mvPexBarEnable: ERR. Invalid bar number %d\n", barNum); - return MV_BAD_PARAM; - } - - if (PEX_INTER_REGS_BAR == barNum) - { - if (MV_TRUE == enable) - { - return MV_OK; - } - else - { - return MV_ERROR; - } - } - - - if (MV_FALSE == enable) - { - /* disable bar and quit */ - MV_REG_BIT_RESET(PEX_BAR_CTRL_REG(pexIf,barNum),PXBCR_BAR_EN); - return MV_OK; - } - - /* else */ - - if (mvPexBarGet(pexIf,barNum,&pexBar) != MV_OK) - { - mvOsPrintf("mvPexBarEnable: mvPexBarGet Failed\n"); - return MV_ERROR; - - } - - if (MV_TRUE == pexBar.enable) - { - /* it is already enabled !!! */ - return MV_OK; - } - - /* else enable the bar*/ - - pexBar.enable = MV_TRUE; - - if (mvPexBarSet(pexIf,barNum,&pexBar) != MV_OK) - { - mvOsPrintf("mvPexBarEnable: mvPexBarSet Failed\n"); - return MV_ERROR; - - } - - return MV_OK; -} - - -/******************************************************************************* -* pexWinOverlapDetect - Detect address windows overlapping -* -* DESCRIPTION: -* This function detects address window overlapping of a given address -* window in PEX BARs. -* -* INPUT: -* pAddrWin - Address window to be checked. -* bar - BAR to be accessed by slave. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise. -* -*******************************************************************************/ -static MV_BOOL pexWinOverlapDetect(MV_U32 pexIf, - MV_U32 winNum, - MV_ADDR_WIN *pAddrWin) -{ - MV_U32 win; - MV_PEX_DEC_WIN addrDecWin; - - - for(win = 0; win < PEX_MAX_TARGET_WIN -2 ; win++) - { - /* don't check our target or illegal targets */ - if (winNum == win) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvPexTargetWinGet(pexIf, win, &addrDecWin)) - { - mvOsPrintf("pexWinOverlapDetect: ERR. TargetWinGet failed win=%x\n", - win); - return MV_ERROR; - } - - /* Do not check disabled windows */ - if (MV_FALSE == addrDecWin.enable) - { - continue; - } - - - if(MV_TRUE == ctrlWinOverlapTest(pAddrWin, &addrDecWin.addrWin)) - { - mvOsPrintf("pexWinOverlapDetect: winNum %d overlap current %d\n", - winNum, win); - return MV_TRUE; - } - } - - return MV_FALSE; -} - -/******************************************************************************* -* pexIsWinWithinBar - Detect if address is within PEX bar boundries -* -* DESCRIPTION: -* -* INPUT: -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise. -* -*******************************************************************************/ -static MV_BOOL pexIsWinWithinBar(MV_U32 pexIf, - MV_ADDR_WIN *pAddrWin) -{ - MV_U32 bar; - MV_PEX_BAR addrDecWin; - - for(bar = 0; bar < PEX_MAX_BARS; bar++) - { - - /* Get window parameters */ - if (MV_OK != mvPexBarGet(pexIf, bar, &addrDecWin)) - { - mvOsPrintf("pexIsWinWithinBar: ERR. mvPexBarGet failed\n"); - return MV_ERROR; - } - - /* Do not check disabled bars */ - if (MV_FALSE == addrDecWin.enable) - { - continue; - } - - - if(MV_TRUE == ctrlWinWithinWinTest(pAddrWin, &addrDecWin.addrWin)) - { - return MV_TRUE; - } - } - - return MV_FALSE; - -} - -/******************************************************************************* -* pexBarOverlapDetect - Detect address windows overlapping -* -* DESCRIPTION: -* This function detects address window overlapping of a given address -* window in PEX BARs. -* -* INPUT: -* pAddrWin - Address window to be checked. -* bar - BAR to be accessed by slave. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise. -* -*******************************************************************************/ -static MV_BOOL pexBarOverlapDetect(MV_U32 pexIf, - MV_U32 barNum, - MV_ADDR_WIN *pAddrWin) -{ - MV_U32 bar; - MV_PEX_BAR barDecWin; - - - for(bar = 0; bar < PEX_MAX_BARS; bar++) - { - /* don't check our target or illegal targets */ - if (barNum == bar) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvPexBarGet(pexIf, bar, &barDecWin)) - { - mvOsPrintf("pexBarOverlapDetect: ERR. TargetWinGet failed\n"); - return MV_ERROR; - } - - /* don'nt check disabled bars */ - if (barDecWin.enable == MV_FALSE) - { - continue; - } - - - if(MV_TRUE == ctrlWinOverlapTest(pAddrWin, &barDecWin.addrWin)) - { - mvOsPrintf("pexBarOverlapDetect: winNum %d overlap current %d\n", - barNum, bar); - return MV_TRUE; - } - } - - return MV_FALSE; -} - -/******************************************************************************* -* pexBarIsValid - Check if the given address window is valid -* -* DESCRIPTION: -* PEX spec restrict BAR base to be aligned to BAR size. -* This function checks if the given address window is valid. -* -* INPUT: -* baseLow - 32bit low base address. -* size - Window size. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the address window is valid, MV_FALSE otherwise. -* -*******************************************************************************/ -static MV_STATUS pexBarIsValid(MV_U32 baseLow, MV_U32 size) -{ - - /* PCI spec restrict BAR base to be aligned to BAR size */ - if(MV_IS_NOT_ALIGN(baseLow, size)) - { - return MV_ERROR; - } - else - { - return MV_TRUE; - } - - return MV_TRUE; -} - -/******************************************************************************* -* pexBarRegInfoGet - Get BAR register information -* -* DESCRIPTION: -* PEX BARs registers offsets are inconsecutive. -* This function gets a PEX BAR register information like register offsets -* and function location of the BAR. -* -* INPUT: -* pexIf - PEX interface number. -* bar - The PEX BAR in question. -* -* OUTPUT: -* pBarRegInfo - BAR register info struct. -* -* RETURN: -* MV_BAD_PARAM when bad parameters ,MV_ERROR on error ,othewise MV_OK -* -*******************************************************************************/ -static MV_STATUS pexWinRegInfoGet(MV_U32 pexIf, - MV_U32 winNum, - PEX_WIN_REG_INFO *pWinRegInfo) -{ - - if ((winNum >= 0)&&(winNum <=3)) - { - pWinRegInfo->baseLowRegOffs = PEX_WIN0_3_BASE_REG(pexIf,winNum); - pWinRegInfo->baseHighRegOffs = 0; - pWinRegInfo->sizeRegOffs = PEX_WIN0_3_CTRL_REG(pexIf,winNum); - pWinRegInfo->remapLowRegOffs = PEX_WIN0_3_REMAP_REG(pexIf,winNum); - pWinRegInfo->remapHighRegOffs = 0; - } - else if ((winNum >= 4)&&(winNum <=5)) - { - pWinRegInfo->baseLowRegOffs = PEX_WIN4_5_BASE_REG(pexIf,winNum); - pWinRegInfo->baseHighRegOffs = 0; - pWinRegInfo->sizeRegOffs = PEX_WIN4_5_CTRL_REG(pexIf,winNum); - pWinRegInfo->remapLowRegOffs = PEX_WIN4_5_REMAP_REG(pexIf,winNum); - pWinRegInfo->remapHighRegOffs = PEX_WIN4_5_REMAP_HIGH_REG(pexIf,winNum); - - } - else if (MV_PEX_WIN_DEFAULT == winNum) - { - pWinRegInfo->baseLowRegOffs = 0; - pWinRegInfo->baseHighRegOffs = 0; - pWinRegInfo->sizeRegOffs = PEX_WIN_DEFAULT_CTRL_REG(pexIf); - pWinRegInfo->remapLowRegOffs = 0; - pWinRegInfo->remapHighRegOffs = 0; - } - else if (MV_PEX_WIN_EXP_ROM == winNum) - { - pWinRegInfo->baseLowRegOffs = 0; - pWinRegInfo->baseHighRegOffs = 0; - pWinRegInfo->sizeRegOffs = PEX_WIN_EXP_ROM_CTRL_REG(pexIf); - pWinRegInfo->remapLowRegOffs = PEX_WIN_EXP_ROM_REMAP_REG(pexIf); - pWinRegInfo->remapHighRegOffs = 0; - - } - - return MV_OK; -} - -/******************************************************************************* -* pexBarNameGet - Get the string name of PEX BAR. -* -* DESCRIPTION: -* This function get the string name of PEX BAR. -* -* INPUT: -* bar - PEX bar number. -* -* OUTPUT: -* None. -* -* RETURN: -* pointer to the string name of PEX BAR. -* -*******************************************************************************/ -const MV_8* pexBarNameGet( MV_U32 bar ) -{ - switch( bar ) - { - case PEX_INTER_REGS_BAR: - return "Internal Regs Bar0...."; - case PEX_DRAM_BAR: - return "DRAM Bar1............."; - case PEX_DEVICE_BAR: - return "Devices Bar2.........."; - default: - return "Bar unknown"; - } -} -/******************************************************************************* -* mvPexAddrDecShow - Print the PEX address decode map (BARs and windows). -* -* DESCRIPTION: -* This function print the PEX address decode map (BARs and windows). -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvPexAddrDecShow(MV_VOID) -{ - MV_PEX_BAR pexBar; - MV_PEX_DEC_WIN win; - MV_U32 pexIf; - MV_U32 bar,winNum; - - for( pexIf = 0; pexIf < mvCtrlPexMaxIfGet(); pexIf++ ) - { - if (MV_FALSE == mvCtrlPwrClckGet(PEX_UNIT_ID, pexIf)) continue; - mvOsOutput( "\n" ); - mvOsOutput( "PEX%d:\n", pexIf ); - mvOsOutput( "-----\n" ); - - mvOsOutput( "\nPex Bars \n\n"); - - for( bar = 0; bar < PEX_MAX_BARS; bar++ ) - { - memset( &pexBar, 0, sizeof(MV_PEX_BAR) ); - - mvOsOutput( "%s ", pexBarNameGet(bar) ); - - if( mvPexBarGet( pexIf, bar, &pexBar ) == MV_OK ) - { - if( pexBar.enable ) - { - mvOsOutput( "base %08x, ", pexBar.addrWin.baseLow ); - mvSizePrint( pexBar.addrWin.size ); - mvOsOutput( "\n" ); - } - else - mvOsOutput( "disable\n" ); - } - } - mvOsOutput( "\nPex Decode Windows\n\n"); - - for( winNum = 0; winNum < PEX_MAX_TARGET_WIN - 2; winNum++) - { - memset( &win, 0,sizeof(MV_PEX_DEC_WIN) ); - - mvOsOutput( "win%d - ", winNum ); - - if ( mvPexTargetWinGet(pexIf,winNum,&win) == MV_OK) - { - if (win.enable) - { - mvOsOutput( "%s base %08x, ", - mvCtrlTargetNameGet(win.target), win.addrWin.baseLow ); - mvOsOutput( "...." ); - mvSizePrint( win.addrWin.size ); - - mvOsOutput( "\n" ); - } - else - mvOsOutput( "disable\n" ); - - - } - } - - memset( &win, 0,sizeof(MV_PEX_DEC_WIN) ); - - mvOsOutput( "default win - " ); - - if ( mvPexTargetWinGet(pexIf, MV_PEX_WIN_DEFAULT, &win) == MV_OK) - { - mvOsOutput( "%s ", - mvCtrlTargetNameGet(win.target) ); - mvOsOutput( "\n" ); - } - memset( &win, 0,sizeof(MV_PEX_DEC_WIN) ); - - mvOsOutput( "Expansion ROM - " ); - - if ( mvPexTargetWinGet(pexIf, MV_PEX_WIN_EXP_ROM, &win) == MV_OK) - { - mvOsOutput( "%s ", - mvCtrlTargetNameGet(win.target) ); - mvOsOutput( "\n" ); - } - - } -} - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysPex.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysPex.h deleted file mode 100644 index 3505613b7f..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysPex.h +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCSysPEXH -#define __INCSysPEXH - -#include "mvCommon.h" -#include "ctrlEnv/sys/mvCpuIf.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/mvCtrlEnvAddrDec.h" - -/* 4KB granularity */ -#define MINIMUM_WINDOW_SIZE 0x1000 -#define MINIMUM_BAR_SIZE 0x1000 -#define MINIMUM_BAR_SIZE_MASK 0xFFFFF000 -#define BAR_SIZE_OFFS 12 -#define BAR_SIZE_MASK (0xFFFFF << BAR_SIZE_OFFS) - - - -#define MV_PEX_WIN_DEFAULT 6 -#define MV_PEX_WIN_EXP_ROM 7 -#define PEX_MAX_TARGET_WIN 8 - - -#define PEX_MAX_BARS 3 -#define PEX_INTER_REGS_BAR 0 -#define PEX_DRAM_BAR 1 -#define PEX_DEVICE_BAR 2 - -/*************************************/ -/* PCI Express BAR Control Registers */ -/*************************************/ -#define PEX_BAR_CTRL_REG(pexIf,bar) (0x41804 + (bar-1)*4- (pexIf)*0x10000) -#define PEX_EXP_ROM_BAR_CTRL_REG(pexIf) (0x4180C - (pexIf)*0x10000) - - -/* PCI Express BAR Control Register */ -/* PEX_BAR_CTRL_REG (PXBCR) */ - -#define PXBCR_BAR_EN BIT0 -#define PXBCR_BAR_SIZE_OFFS 16 -#define PXBCR_BAR_SIZE_MASK (0xffff << PXBCR_BAR_SIZE_OFFS) -#define PXBCR_BAR_SIZE_ALIGNMENT 0x10000 - - - -/* PCI Express Expansion ROM BAR Control Register */ -/* PEX_EXP_ROM_BAR_CTRL_REG (PXERBCR) */ - -#define PXERBCR_EXPROM_EN BIT0 -#define PXERBCR_EXPROMSZ_OFFS 19 -#define PXERBCR_EXPROMSZ_MASK (0xf << PXERBCR_EXPROMSZ_OFFS) -#define PXERBCR_EXPROMSZ_512KB (0x0 << PXERBCR_EXPROMSZ_OFFS) -#define PXERBCR_EXPROMSZ_1024KB (0x1 << PXERBCR_EXPROMSZ_OFFS) -#define PXERBCR_EXPROMSZ_2048KB (0x3 << PXERBCR_EXPROMSZ_OFFS) -#define PXERBCR_EXPROMSZ_4096KB (0x7 << PXERBCR_EXPROMSZ_OFFS) - -/************************************************/ -/* PCI Express Address Window Control Registers */ -/************************************************/ -#define PEX_WIN0_3_CTRL_REG(pexIf,winNum) \ - (0x41820 + (winNum) * 0x10 - (pexIf) * 0x10000) -#define PEX_WIN0_3_BASE_REG(pexIf,winNum) \ - (0x41824 + (winNum) * 0x10 - (pexIf) * 0x10000) -#define PEX_WIN0_3_REMAP_REG(pexIf,winNum) \ - (0x4182C + (winNum) * 0x10 - (pexIf) * 0x10000) -#define PEX_WIN4_5_CTRL_REG(pexIf,winNum) \ - (0x41860 + (winNum - 4) * 0x20 - (pexIf) * 0x10000) -#define PEX_WIN4_5_BASE_REG(pexIf,winNum) \ - (0x41864 + (winNum - 4) * 0x20 - (pexIf) * 0x10000) -#define PEX_WIN4_5_REMAP_REG(pexIf,winNum) \ - (0x4186C + (winNum - 4) * 0x20 - (pexIf) * 0x10000) -#define PEX_WIN4_5_REMAP_HIGH_REG(pexIf,winNum) \ - (0x41870 + (winNum - 4) * 0x20 - (pexIf) * 0x10000) - -#define PEX_WIN_DEFAULT_CTRL_REG(pexIf) (0x418B0 - (pexIf) * 0x10000) -#define PEX_WIN_EXP_ROM_CTRL_REG(pexIf) (0x418C0 - (pexIf) * 0x10000) -#define PEX_WIN_EXP_ROM_REMAP_REG(pexIf) (0x418C4 - (pexIf) * 0x10000) - -/* PCI Express Window Control Register */ -/* PEX_WIN_CTRL_REG (PXWCR) */ - -#define PXWCR_WIN_EN BIT0 /* Window Enable.*/ - -#define PXWCR_WIN_BAR_MAP_OFFS 1 /* Mapping to BAR.*/ -#define PXWCR_WIN_BAR_MAP_MASK BIT1 -#define PXWCR_WIN_BAR_MAP_BAR1 (0 << PXWCR_WIN_BAR_MAP_OFFS) -#define PXWCR_WIN_BAR_MAP_BAR2 (1 << PXWCR_WIN_BAR_MAP_OFFS) - -#define PXWCR_TARGET_OFFS 4 /*Unit ID */ -#define PXWCR_TARGET_MASK (0xf << PXWCR_TARGET_OFFS) - -#define PXWCR_ATTRIB_OFFS 8 /* target attributes */ -#define PXWCR_ATTRIB_MASK (0xff << PXWCR_ATTRIB_OFFS) - -#define PXWCR_SIZE_OFFS 16 /* size */ -#define PXWCR_SIZE_MASK (0xffff << PXWCR_SIZE_OFFS) -#define PXWCR_SIZE_ALIGNMENT 0x10000 - -/* PCI Express Window Base Register */ -/* PEX_WIN_BASE_REG (PXWBR)*/ - -#define PXWBR_BASE_OFFS 16 /* address[31:16] */ -#define PXWBR_BASE_MASK (0xffff << PXWBR_BASE_OFFS) -#define PXWBR_BASE_ALIGNMENT 0x10000 - -/* PCI Express Window Remap Register */ -/* PEX_WIN_REMAP_REG (PXWRR)*/ - -#define PXWRR_REMAP_EN BIT0 -#define PXWRR_REMAP_OFFS 16 -#define PXWRR_REMAP_MASK (0xffff << PXWRR_REMAP_OFFS) -#define PXWRR_REMAP_ALIGNMENT 0x10000 - -/* PCI Express Window Remap (High) Register */ -/* PEX_WIN_REMAP_HIGH_REG (PXWRHR)*/ - -#define PXWRHR_REMAP_HIGH_OFFS 0 -#define PXWRHR_REMAP_HIGH_MASK (0xffffffff << PXWRHR_REMAP_HIGH_OFFS) - -/* PCI Express Default Window Control Register */ -/* PEX_WIN_DEFAULT_CTRL_REG (PXWDCR) */ - -#define PXWDCR_TARGET_OFFS 4 /*Unit ID */ -#define PXWDCR_TARGET_MASK (0xf << PXWDCR_TARGET_OFFS) -#define PXWDCR_ATTRIB_OFFS 8 /* target attributes */ -#define PXWDCR_ATTRIB_MASK (0xff << PXWDCR_ATTRIB_OFFS) - -/* PCI Express Expansion ROM Window Control Register */ -/* PEX_WIN_EXP_ROM_CTRL_REG (PXWERCR)*/ - -#define PXWERCR_TARGET_OFFS 4 /*Unit ID */ -#define PXWERCR_TARGET_MASK (0xf << PXWERCR_TARGET_OFFS) -#define PXWERCR_ATTRIB_OFFS 8 /* target attributes */ -#define PXWERCR_ATTRIB_MASK (0xff << PXWERCR_ATTRIB_OFFS) - -/* PCI Express Expansion ROM Window Remap Register */ -/* PEX_WIN_EXP_ROM_REMAP_REG (PXWERRR)*/ - -#define PXWERRR_REMAP_EN BIT0 -#define PXWERRR_REMAP_OFFS 16 -#define PXWERRR_REMAP_MASK (0xffff << PXWERRR_REMAP_OFFS) -#define PXWERRR_REMAP_ALIGNMENT 0x10000 - - - -/*PEX_MEMORY_BAR_BASE_ADDR(barNum) (PXMBBA)*/ -/* PCI Express BAR0 Internal Register*/ -/*PEX BAR0_INTER_REG (PXBIR)*/ - -#define PXBIR_IOSPACE BIT0 /* Memory Space Indicator */ - -#define PXBIR_TYPE_OFFS 1 /* BAR Type/Init Val. */ -#define PXBIR_TYPE_MASK (0x3 << PXBIR_TYPE_OFFS) -#define PXBIR_TYPE_32BIT_ADDR (0x0 << PXBIR_TYPE_OFFS) -#define PXBIR_TYPE_64BIT_ADDR (0x2 << PXBIR_TYPE_OFFS) - -#define PXBIR_PREFETCH_EN BIT3 /* Prefetch Enable */ - -#define PXBIR_BASE_OFFS 20 /* Base address. Address bits [31:20] */ -#define PXBIR_BASE_MASK (0xfff << PXBIR_BASE_OFFS) -#define PXBIR_BASE_ALIGNMET (1 << PXBIR_BASE_OFFS) - - -/* PCI Express BAR0 Internal (High) Register*/ -/*PEX BAR0_INTER_REG_HIGH (PXBIRH)*/ - -#define PXBIRH_BASE_OFFS 0 /* Base address. Bits [63:32] */ -#define PXBIRH_BASE_MASK (0xffffffff << PBBHR_BASE_OFFS) - - -#define PEX_BAR_DEFAULT_ATTRIB 0xc /* Memory - Prefetch - 64 bit address */ -#define PEX_BAR0_DEFAULT_ATTRIB PEX_BAR_DEFAULT_ATTRIB -#define PEX_BAR1_DEFAULT_ATTRIB PEX_BAR_DEFAULT_ATTRIB -#define PEX_BAR2_DEFAULT_ATTRIB PEX_BAR_DEFAULT_ATTRIB - - -/* PCI Express BAR1 Register */ -/* PCI Express BAR2 Register*/ -/*PEX BAR1_REG (PXBR)*/ -/*PEX BAR2_REG (PXBR)*/ - -#define PXBR_IOSPACE BIT0 /* Memory Space Indicator */ - -#define PXBR_TYPE_OFFS 1 /* BAR Type/Init Val. */ -#define PXBR_TYPE_MASK (0x3 << PXBR_TYPE_OFFS) -#define PXBR_TYPE_32BIT_ADDR (0x0 << PXBR_TYPE_OFFS) -#define PXBR_TYPE_64BIT_ADDR (0x2 << PXBR_TYPE_OFFS) - -#define PXBR_PREFETCH_EN BIT3 /* Prefetch Enable */ - -#define PXBR_BASE_OFFS 16 /* Base address. Address bits [31:16] */ -#define PXBR_BASE_MASK (0xffff << PXBR_BASE_OFFS) -#define PXBR_BASE_ALIGNMET (1 << PXBR_BASE_OFFS) - - -/* PCI Express BAR1 (High) Register*/ -/* PCI Express BAR2 (High) Register*/ -/*PEX BAR1_REG_HIGH (PXBRH)*/ -/*PEX BAR2_REG_HIGH (PXBRH)*/ - -#define PXBRH_BASE_OFFS 0 /* Base address. Address bits [63:32] */ -#define PXBRH_BASE_MASK (0xffffffff << PXBRH_BASE_OFFS) - -/* PCI Express Expansion ROM BAR Register*/ -/*PEX_EXPANSION_ROM_BASE_ADDR_REG (PXERBAR)*/ - -#define PXERBAR_EXPROMEN BIT0 /* Expansion ROM Enable */ - -#define PXERBAR_BASE_512K_OFFS 19 /* Expansion ROM Base Address */ -#define PXERBAR_BASE_512K_MASK (0x1fff << PXERBAR_BASE_512K_OFFS) - -#define PXERBAR_BASE_1MB_OFFS 20 /* Expansion ROM Base Address */ -#define PXERBAR_BASE_1MB_MASK (0xfff << PXERBAR_BASE_1MB_OFFS) - -#define PXERBAR_BASE_2MB_OFFS 21 /* Expansion ROM Base Address */ -#define PXERBAR_BASE_2MB_MASK (0x7ff << PXERBAR_BASE_2MB_OFFS) - -#define PXERBAR_BASE_4MB_OFFS 22 /* Expansion ROM Base Address */ -#define PXERBAR_BASE_4MB_MASK (0x3ff << PXERBAR_BASE_4MB_OFFS) - -/* PEX Bar attributes */ -typedef struct _mvPexBar -{ - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -}MV_PEX_BAR; - -/* PEX Remap Window attributes */ -typedef struct _mvPexRemapWin -{ - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -}MV_PEX_REMAP_WIN; - -/* PEX Remap Window attributes */ -typedef struct _mvPexDecWin -{ - MV_TARGET target; - MV_ADDR_WIN addrWin; /* An address window*/ - MV_U32 targetBar; - MV_U8 attrib; /* chip select attributes */ - MV_TARGET_ID targetId; /* Target Id of this MV_TARGET */ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -}MV_PEX_DEC_WIN; - -/* Global Functions prototypes */ -/* mvPexHalInit - Initialize PEX interfaces*/ -MV_STATUS mvPexInit(MV_U32 pexIf, MV_PEX_TYPE pexType); - - -/* mvPexTargetWinSet - Set PEX to peripheral target address window BAR*/ -MV_STATUS mvPexTargetWinSet(MV_U32 pexIf, MV_U32 winNum, - MV_PEX_DEC_WIN *pAddrDecWin); - -/* mvPexTargetWinGet - Get PEX to peripheral target address window*/ -MV_STATUS mvPexTargetWinGet(MV_U32 pexIf, MV_U32 winNum, - MV_PEX_DEC_WIN *pAddrDecWin); - -/* mvPexTargetWinEnable - Enable/disable a PEX BAR window*/ -MV_STATUS mvPexTargetWinEnable(MV_U32 pexIf,MV_U32 winNum, MV_BOOL enable); - -/* mvPexTargetWinRemap - Set PEX to target address window remap.*/ -MV_STATUS mvPexTargetWinRemap(MV_U32 pexIf, MV_U32 winNum, - MV_PEX_REMAP_WIN *pAddrWin); - -/* mvPexTargetWinRemapEnable -enable\disable a PEX Window remap.*/ -MV_STATUS mvPexTargetWinRemapEnable(MV_U32 pexIf, MV_U32 winNum, - MV_BOOL enable); - -/* mvPexBarSet - Set PEX bar address and size */ -MV_STATUS mvPexBarSet(MV_U32 pexIf, MV_U32 barNum, MV_PEX_BAR *addrWin); - -/* mvPexBarGet - Get PEX bar address and size */ -MV_STATUS mvPexBarGet(MV_U32 pexIf, MV_U32 barNum, MV_PEX_BAR *addrWin); - -/* mvPexBarEnable - enable\disable a PEX bar*/ -MV_STATUS mvPexBarEnable(MV_U32 pexIf, MV_U32 barNum, MV_BOOL enable); - -/* mvPexAddrDecShow - Display address decode windows attributes */ -MV_VOID mvPexAddrDecShow(MV_VOID); - -#endif diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSata.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSata.c deleted file mode 100644 index f100a12d10..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSata.c +++ /dev/null @@ -1,430 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#include "mvTypes.h" -#include "mvCommon.h" -#include "mvOs.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "cpu/mvCpu.h" -#include "ctrlEnv/sys/mvCpuIf.h" -#include "sata/CoreDriver/mvRegs.h" -#include "ctrlEnv/sys/mvSysSata.h" - -MV_TARGET sataAddrDecPrioTab[] = -{ -#if defined(MV_INCLUDE_SDRAM_CS0) - SDRAM_CS0, -#endif -#if defined(MV_INCLUDE_SDRAM_CS1) - SDRAM_CS1, -#endif -#if defined(MV_INCLUDE_SDRAM_CS2) - SDRAM_CS2, -#endif -#if defined(MV_INCLUDE_SDRAM_CS3) - SDRAM_CS3, -#endif -#if defined(MV_INCLUDE_PEX) - PEX0_MEM, -#endif - TBL_TERM -}; - - -/******************************************************************************* -* sataWinOverlapDetect - Detect SATA address windows overlapping -* -* DESCRIPTION: -* An unpredicted behaviur is expected in case SATA address decode -* windows overlapps. -* This function detects SATA address decode windows overlapping of a -* specified window. The function does not check the window itself for -* overlapping. The function also skipps disabled address decode windows. -* -* INPUT: -* winNum - address decode window number. -* pAddrDecWin - An address decode window struct. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data -* from registers. -* -*******************************************************************************/ -static MV_STATUS sataWinOverlapDetect(int dev, MV_U32 winNum, - MV_ADDR_WIN *pAddrWin) -{ - MV_U32 winNumIndex; - MV_SATA_DEC_WIN addrDecWin; - - for(winNumIndex=0; winNumIndex<MV_SATA_MAX_ADDR_DECODE_WIN; winNumIndex++) - { - /* Do not check window itself */ - if (winNumIndex == winNum) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvSataWinGet(dev, winNumIndex, &addrDecWin)) - { - mvOsPrintf("%s: ERR. TargetWinGet failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* Do not check disabled windows */ - if(addrDecWin.enable == MV_FALSE) - { - continue; - } - - if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin))) - { - return MV_TRUE; - } - } - return MV_FALSE; -} - - -/******************************************************************************* -* mvSataWinSet - Set SATA target address window -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) -* address window, also known as address decode window. -* After setting this target window, the SATA will be able to access the -* target within the address window. -* -* INPUT: -* winNum - SATA target address decode window number. -* pAddrDecWin - SATA target window data structure. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if address window overlapps with other address decode windows. -* MV_BAD_PARAM if base address is invalid parameter or target is -* unknown. -* -*******************************************************************************/ -MV_STATUS mvSataWinSet(int dev, MV_U32 winNum, MV_SATA_DEC_WIN *pAddrDecWin) -{ - MV_TARGET_ATTRIB targetAttribs; - MV_DEC_REGS decRegs; - - /* Parameter checking */ - if (winNum >= MV_SATA_MAX_ADDR_DECODE_WIN) - { - mvOsPrintf("%s: ERR. Invalid win num %d\n",__FUNCTION__, winNum); - return MV_BAD_PARAM; - } - - /* Check if the requested window overlapps with current windows */ - if (MV_TRUE == sataWinOverlapDetect(dev, winNum, &pAddrDecWin->addrWin)) - { - mvOsPrintf("%s: ERR. Window %d overlap\n", __FUNCTION__, winNum); - return MV_ERROR; - } - - /* check if address is aligned to the size */ - if(MV_IS_NOT_ALIGN(pAddrDecWin->addrWin.baseLow, pAddrDecWin->addrWin.size)) - { - mvOsPrintf("mvSataWinSet:Error setting SATA window %d to "\ - "target %s.\nAddress 0x%08x is unaligned to size 0x%x.\n", - winNum, - mvCtrlTargetNameGet(pAddrDecWin->target), - pAddrDecWin->addrWin.baseLow, - pAddrDecWin->addrWin.size); - return MV_ERROR; - } - - decRegs.baseReg = 0; - decRegs.sizeReg = 0; - - if (MV_OK != mvCtrlAddrDecToReg(&(pAddrDecWin->addrWin),&decRegs)) - { - mvOsPrintf("%s: mvCtrlAddrDecToReg Failed\n", __FUNCTION__); - return MV_ERROR; - } - - mvCtrlAttribGet(pAddrDecWin->target, &targetAttribs); - - /* set attributes */ - decRegs.sizeReg &= ~MV_SATA_WIN_ATTR_MASK; - decRegs.sizeReg |= (targetAttribs.attrib << MV_SATA_WIN_ATTR_OFFSET); - - /* set target ID */ - decRegs.sizeReg &= ~MV_SATA_WIN_TARGET_MASK; - decRegs.sizeReg |= (targetAttribs.targetId << MV_SATA_WIN_TARGET_OFFSET); - - if (pAddrDecWin->enable == MV_TRUE) - { - decRegs.sizeReg |= MV_SATA_WIN_ENABLE_MASK; - } - else - { - decRegs.sizeReg &= ~MV_SATA_WIN_ENABLE_MASK; - } - - MV_REG_WRITE( MV_SATA_WIN_CTRL_REG(dev, winNum), decRegs.sizeReg); - MV_REG_WRITE( MV_SATA_WIN_BASE_REG(dev, winNum), decRegs.baseReg); - - return MV_OK; -} - -/******************************************************************************* -* mvSataWinGet - Get SATA peripheral target address window. -* -* DESCRIPTION: -* Get SATA peripheral target address window. -* -* INPUT: -* winNum - SATA target address decode window number. -* -* OUTPUT: -* pAddrDecWin - SATA target window data structure. -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvSataWinGet(int dev, MV_U32 winNum, MV_SATA_DEC_WIN *pAddrDecWin) -{ - MV_DEC_REGS decRegs; - MV_TARGET_ATTRIB targetAttrib; - - /* Parameter checking */ - if (winNum >= MV_SATA_MAX_ADDR_DECODE_WIN) - { - mvOsPrintf("%s (dev=%d): ERR. Invalid winNum %d\n", - __FUNCTION__, dev, winNum); - return MV_NOT_SUPPORTED; - } - - decRegs.baseReg = MV_REG_READ( MV_SATA_WIN_BASE_REG(dev, winNum) ); - decRegs.sizeReg = MV_REG_READ( MV_SATA_WIN_CTRL_REG(dev, winNum) ); - - if (MV_OK != mvCtrlRegToAddrDec(&decRegs, &pAddrDecWin->addrWin) ) - { - mvOsPrintf("%s: mvCtrlRegToAddrDec Failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* attrib and targetId */ - targetAttrib.attrib = (decRegs.sizeReg & MV_SATA_WIN_ATTR_MASK) >> - MV_SATA_WIN_ATTR_OFFSET; - targetAttrib.targetId = (decRegs.sizeReg & MV_SATA_WIN_TARGET_MASK) >> - MV_SATA_WIN_TARGET_OFFSET; - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - /* Check if window is enabled */ - if(decRegs.sizeReg & MV_SATA_WIN_ENABLE_MASK) - { - pAddrDecWin->enable = MV_TRUE; - } - else - { - pAddrDecWin->enable = MV_FALSE; - } - return MV_OK; -} -/******************************************************************************* -* mvSataAddrDecShow - Print the SATA address decode map. -* -* DESCRIPTION: -* This function print the SATA address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvSataAddrDecShow(MV_VOID) -{ - - MV_SATA_DEC_WIN win; - int i,j; - - - - for( j = 0; j < MV_SATA_MAX_CHAN; j++ ) - { - if (MV_FALSE == mvCtrlPwrClckGet(SATA_UNIT_ID, j)) - return; - - mvOsOutput( "\n" ); - mvOsOutput( "SATA %d:\n", j ); - mvOsOutput( "----\n" ); - - for( i = 0; i < MV_SATA_MAX_ADDR_DECODE_WIN; i++ ) - { - memset( &win, 0, sizeof(MV_SATA_DEC_WIN) ); - - mvOsOutput( "win%d - ", i ); - - if( mvSataWinGet(j, i, &win ) == MV_OK ) - { - if( win.enable ) - { - mvOsOutput( "%s base %08x, ", - mvCtrlTargetNameGet(win.target), win.addrWin.baseLow ); - mvOsOutput( "...." ); - - mvSizePrint( win.addrWin.size ); - - mvOsOutput( "\n" ); - } - else - mvOsOutput( "disable\n" ); - } - } - } -} - - -/******************************************************************************* -* mvSataWinInit - Initialize the integrated SATA target address window. -* -* DESCRIPTION: -* Initialize the SATA peripheral target address window. -* -* INPUT: -* -* -* OUTPUT: -* -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvSataWinInit(MV_VOID) -{ - int winNum; - MV_SATA_DEC_WIN sataWin; - MV_CPU_DEC_WIN cpuAddrDecWin; - MV_U32 status, winPrioIndex = 0; - - /* Initiate Sata address decode */ - - /* First disable all address decode windows */ - for(winNum = 0; winNum < MV_SATA_MAX_ADDR_DECODE_WIN; winNum++) - { - MV_U32 regVal = MV_REG_READ(MV_SATA_WIN_CTRL_REG(0, winNum)); - regVal &= ~MV_SATA_WIN_ENABLE_MASK; - MV_REG_WRITE(MV_SATA_WIN_CTRL_REG(0, winNum), regVal); - } - - winNum = 0; - while( (sataAddrDecPrioTab[winPrioIndex] != TBL_TERM) && - (winNum < MV_SATA_MAX_ADDR_DECODE_WIN) ) - { - /* first get attributes from CPU If */ - status = mvCpuIfTargetWinGet(sataAddrDecPrioTab[winPrioIndex], - &cpuAddrDecWin); - - if(MV_NO_SUCH == status) - { - winPrioIndex++; - continue; - } - if (MV_OK != status) - { - mvOsPrintf("%s: ERR. mvCpuIfTargetWinGet failed\n", __FUNCTION__); - return MV_ERROR; - } - - if (cpuAddrDecWin.enable == MV_TRUE) - { - sataWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; - sataWin.addrWin.baseLow = cpuAddrDecWin.addrWin.baseLow; - sataWin.addrWin.size = cpuAddrDecWin.addrWin.size; - sataWin.enable = MV_TRUE; - sataWin.target = sataAddrDecPrioTab[winPrioIndex]; - - if(MV_OK != mvSataWinSet(0/*dev*/, winNum, &sataWin)) - { - return MV_ERROR; - } - winNum++; - } - winPrioIndex++; - } - return MV_OK; -} - - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSata.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSata.h deleted file mode 100644 index 611f5776b7..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSata.h +++ /dev/null @@ -1,128 +0,0 @@ - -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ -#ifndef __INCMVSysSataAddrDech -#define __INCMVSysSataAddrDech - -#include "mvCommon.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/sys/mvCpuIf.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _mvSataDecWin -{ - MV_TARGET target; - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -} MV_SATA_DEC_WIN; - - -#define MV_SATA_MAX_ADDR_DECODE_WIN 4 - -#define MV_SATA_WIN_CTRL_REG(dev, win) (SATA_REG_BASE + 0x30 + ((win)<<4)) -#define MV_SATA_WIN_BASE_REG(dev, win) (SATA_REG_BASE + 0x34 + ((win)<<4)) - -/* BITs in Bridge Interrupt Cause and Mask registers */ -#define MV_SATA_ADDR_DECODE_ERROR_BIT 0 -#define MV_SATA_ADDR_DECODE_ERROR_MASK (1<<MV_SATA_ADDR_DECODE_ERROR_BIT) - -/* BITs in Windows 0-3 Control and Base Registers */ -#define MV_SATA_WIN_ENABLE_BIT 0 -#define MV_SATA_WIN_ENABLE_MASK (1<<MV_SATA_WIN_ENABLE_BIT) - -#define MV_SATA_WIN_TARGET_OFFSET 4 -#define MV_SATA_WIN_TARGET_MASK (0xF<<MV_SATA_WIN_TARGET_OFFSET) - -#define MV_SATA_WIN_ATTR_OFFSET 8 -#define MV_SATA_WIN_ATTR_MASK (0xFF<<MV_SATA_WIN_ATTR_OFFSET) - -#define MV_SATA_WIN_SIZE_OFFSET 16 -#define MV_SATA_WIN_SIZE_MASK (0xFFFF<<MV_SATA_WIN_SIZE_OFFSET) - -#define MV_SATA_WIN_BASE_OFFSET 16 -#define MV_SATA_WIN_BASE_MASK (0xFFFF<<MV_SATA_WIN_BASE_OFFSET) - -MV_STATUS mvSataWinGet(int dev, MV_U32 winNum, MV_SATA_DEC_WIN *pAddrDecWin); -MV_STATUS mvSataWinSet(int dev, MV_U32 winNum, MV_SATA_DEC_WIN *pAddrDecWin); -MV_STATUS mvSataWinByTargetGet(MV_TARGET target, MV_SATA_DEC_WIN *pAddrDecWin); -MV_STATUS mvSataWinInit(MV_VOID); -MV_VOID mvSataAddrDecShow(MV_VOID); - - -#ifdef __cplusplus -} -#endif - - -#endif - - - - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSdmmc.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSdmmc.c deleted file mode 100644 index 6d2a919242..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSdmmc.c +++ /dev/null @@ -1,427 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#include "mvTypes.h" -#include "mvCommon.h" -#include "mvOs.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "cpu/mvCpu.h" -#include "ctrlEnv/sys/mvCpuIf.h" -#include "mvRegs.h" -#include "ctrlEnv/sys/mvSysSdmmc.h" - -MV_TARGET sdmmcAddrDecPrioTab[] = -{ -#if defined(MV_INCLUDE_SDRAM_CS0) - SDRAM_CS0, -#endif -#if defined(MV_INCLUDE_SDRAM_CS1) - SDRAM_CS1, -#endif -#if defined(MV_INCLUDE_SDRAM_CS2) - SDRAM_CS2, -#endif -#if defined(MV_INCLUDE_SDRAM_CS3) - SDRAM_CS3, -#endif -#if defined(MV_INCLUDE_PEX) - PEX0_MEM, -#endif - TBL_TERM -}; - - -/******************************************************************************* -* sdmmcWinOverlapDetect - Detect SDMMC address windows overlapping -* -* DESCRIPTION: -* An unpredicted behaviur is expected in case SDMMC address decode -* windows overlapps. -* This function detects SDMMC address decode windows overlapping of a -* specified window. The function does not check the window itself for -* overlapping. The function also skipps disabled address decode windows. -* -* INPUT: -* winNum - address decode window number. -* pAddrDecWin - An address decode window struct. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data -* from registers. -* -*******************************************************************************/ -static MV_STATUS sdmmcWinOverlapDetect(int dev, MV_U32 winNum, - MV_ADDR_WIN *pAddrWin) -{ - MV_U32 winNumIndex; - MV_SDMMC_DEC_WIN addrDecWin; - - for(winNumIndex=0; winNumIndex<MV_SDMMC_MAX_ADDR_DECODE_WIN; winNumIndex++) - { - /* Do not check window itself */ - if (winNumIndex == winNum) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvSdmmcWinGet(dev, winNumIndex, &addrDecWin)) - { - mvOsPrintf("%s: ERR. TargetWinGet failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* Do not check disabled windows */ - if(addrDecWin.enable == MV_FALSE) - { - continue; - } - - if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin))) - { - return MV_TRUE; - } - } - return MV_FALSE; -} - - -/******************************************************************************* -* mvSdmmcWinSet - Set SDMMC target address window -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) -* address window, also known as address decode window. -* After setting this target window, the SDMMC will be able to access the -* target within the address window. -* -* INPUT: -* winNum - SDMMC target address decode window number. -* pAddrDecWin - SDMMC target window data structure. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if address window overlapps with other address decode windows. -* MV_BAD_PARAM if base address is invalid parameter or target is -* unknown. -* -*******************************************************************************/ -MV_STATUS mvSdmmcWinSet(int dev, MV_U32 winNum, MV_SDMMC_DEC_WIN *pAddrDecWin) -{ - MV_TARGET_ATTRIB targetAttribs; - MV_DEC_REGS decRegs; - - /* Parameter checking */ - if (winNum >= MV_SDMMC_MAX_ADDR_DECODE_WIN) - { - mvOsPrintf("%s: ERR. Invalid win num %d\n",__FUNCTION__, winNum); - return MV_BAD_PARAM; - } - - /* Check if the requested window overlapps with current windows */ - if (MV_TRUE == sdmmcWinOverlapDetect(dev, winNum, &pAddrDecWin->addrWin)) - { - mvOsPrintf("%s: ERR. Window %d overlap\n", __FUNCTION__, winNum); - return MV_ERROR; - } - - /* check if address is aligned to the size */ - if(MV_IS_NOT_ALIGN(pAddrDecWin->addrWin.baseLow, pAddrDecWin->addrWin.size)) - { - mvOsPrintf("mvSdmmcWinSet:Error setting SDMMC window %d to "\ - "target %s.\nAddress 0x%08x is unaligned to size 0x%x.\n", - winNum, - mvCtrlTargetNameGet(pAddrDecWin->target), - pAddrDecWin->addrWin.baseLow, - pAddrDecWin->addrWin.size); - return MV_ERROR; - } - - decRegs.baseReg = 0; - decRegs.sizeReg = 0; - - if (MV_OK != mvCtrlAddrDecToReg(&(pAddrDecWin->addrWin),&decRegs)) - { - mvOsPrintf("%s: mvCtrlAddrDecToReg Failed\n", __FUNCTION__); - return MV_ERROR; - } - - mvCtrlAttribGet(pAddrDecWin->target, &targetAttribs); - - /* set attributes */ - decRegs.sizeReg &= ~MV_SDMMC_WIN_ATTR_MASK; - decRegs.sizeReg |= (targetAttribs.attrib << MV_SDMMC_WIN_ATTR_OFFSET); - - /* set target ID */ - decRegs.sizeReg &= ~MV_SDMMC_WIN_TARGET_MASK; - decRegs.sizeReg |= (targetAttribs.targetId << MV_SDMMC_WIN_TARGET_OFFSET); - - if (pAddrDecWin->enable == MV_TRUE) - { - decRegs.sizeReg |= MV_SDMMC_WIN_ENABLE_MASK; - } - else - { - decRegs.sizeReg &= ~MV_SDMMC_WIN_ENABLE_MASK; - } - - MV_REG_WRITE( MV_SDMMC_WIN_CTRL_REG(dev, winNum), decRegs.sizeReg); - MV_REG_WRITE( MV_SDMMC_WIN_BASE_REG(dev, winNum), decRegs.baseReg); - - return MV_OK; -} - -/******************************************************************************* -* mvSdmmcWinGet - Get SDMMC peripheral target address window. -* -* DESCRIPTION: -* Get SDMMC peripheral target address window. -* -* INPUT: -* winNum - SDMMC target address decode window number. -*d -* OUTPUT: -* pAddrDecWin - SDMMC target window data structure. -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvSdmmcWinGet(int dev, MV_U32 winNum, MV_SDMMC_DEC_WIN *pAddrDecWin) -{ - MV_DEC_REGS decRegs; - MV_TARGET_ATTRIB targetAttrib; - - /* Parameter checking */ - if (winNum >= MV_SDMMC_MAX_ADDR_DECODE_WIN) - { - mvOsPrintf("%s (dev=%d): ERR. Invalid winNum %d\n", - __FUNCTION__, dev, winNum); - return MV_NOT_SUPPORTED; - } - - decRegs.baseReg = MV_REG_READ( MV_SDMMC_WIN_BASE_REG(dev, winNum) ); - decRegs.sizeReg = MV_REG_READ( MV_SDMMC_WIN_CTRL_REG(dev, winNum) ); - - if (MV_OK != mvCtrlRegToAddrDec(&decRegs, &pAddrDecWin->addrWin) ) - { - mvOsPrintf("%s: mvCtrlRegToAddrDec Failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* attrib and targetId */ - targetAttrib.attrib = (decRegs.sizeReg & MV_SDMMC_WIN_ATTR_MASK) >> - MV_SDMMC_WIN_ATTR_OFFSET; - targetAttrib.targetId = (decRegs.sizeReg & MV_SDMMC_WIN_TARGET_MASK) >> - MV_SDMMC_WIN_TARGET_OFFSET; - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - /* Check if window is enabled */ - if(decRegs.sizeReg & MV_SDMMC_WIN_ENABLE_MASK) - { - pAddrDecWin->enable = MV_TRUE; - } - else - { - pAddrDecWin->enable = MV_FALSE; - } - return MV_OK; -} -/******************************************************************************* -* mvSdmmcAddrDecShow - Print the SDMMC address decode map. -* -* DESCRIPTION: -* This function print the SDMMC address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvSdmmcAddrDecShow(MV_VOID) -{ - - MV_SDMMC_DEC_WIN win; - int i,j=0; - - - - if (MV_FALSE == mvCtrlPwrClckGet(SDIO_UNIT_ID, 0)) - return; - - mvOsOutput( "\n" ); - mvOsOutput( "SDMMC %d:\n", j ); - mvOsOutput( "----\n" ); - - for( i = 0; i < MV_SDMMC_MAX_ADDR_DECODE_WIN; i++ ) - { - memset( &win, 0, sizeof(MV_SDMMC_DEC_WIN) ); - - mvOsOutput( "win%d - ", i ); - - if( mvSdmmcWinGet(j, i, &win ) == MV_OK ) - { - if( win.enable ) - { - mvOsOutput( "%s base %08x, ", - mvCtrlTargetNameGet(win.target), win.addrWin.baseLow ); - mvOsOutput( "...." ); - - mvSizePrint( win.addrWin.size ); - - mvOsOutput( "\n" ); - } - else - mvOsOutput( "disable\n" ); - } - } -} - - -/******************************************************************************* -* mvSdmmcWinInit - Initialize the integrated SDMMC target address window. -* -* DESCRIPTION: -* Initialize the SDMMC peripheral target address window. -* -* INPUT: -* -* -* OUTPUT: -* -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvSdmmcWinInit(MV_VOID) -{ - int winNum; - MV_SDMMC_DEC_WIN sdmmcWin; - MV_CPU_DEC_WIN cpuAddrDecWin; - MV_U32 status, winPrioIndex = 0; - - /* Initiate Sdmmc address decode */ - - /* First disable all address decode windows */ - for(winNum = 0; winNum < MV_SDMMC_MAX_ADDR_DECODE_WIN; winNum++) - { - MV_U32 regVal = MV_REG_READ(MV_SDMMC_WIN_CTRL_REG(0, winNum)); - regVal &= ~MV_SDMMC_WIN_ENABLE_MASK; - MV_REG_WRITE(MV_SDMMC_WIN_CTRL_REG(0, winNum), regVal); - } - - winNum = 0; - while( (sdmmcAddrDecPrioTab[winPrioIndex] != TBL_TERM) && - (winNum < MV_SDMMC_MAX_ADDR_DECODE_WIN) ) - { - /* first get attributes from CPU If */ - status = mvCpuIfTargetWinGet(sdmmcAddrDecPrioTab[winPrioIndex], - &cpuAddrDecWin); - - if(MV_NO_SUCH == status) - { - winPrioIndex++; - continue; - } - if (MV_OK != status) - { - mvOsPrintf("%s: ERR. mvCpuIfTargetWinGet failed\n", __FUNCTION__); - return MV_ERROR; - } - - if (cpuAddrDecWin.enable == MV_TRUE) - { - sdmmcWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; - sdmmcWin.addrWin.baseLow = cpuAddrDecWin.addrWin.baseLow; - sdmmcWin.addrWin.size = cpuAddrDecWin.addrWin.size; - sdmmcWin.enable = MV_TRUE; - sdmmcWin.target = sdmmcAddrDecPrioTab[winPrioIndex]; - - if(MV_OK != mvSdmmcWinSet(0/*dev*/, winNum, &sdmmcWin)) - { - return MV_ERROR; - } - winNum++; - } - winPrioIndex++; - } - return MV_OK; -} - - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSdmmc.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSdmmc.h deleted file mode 100644 index c2f9f79446..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysSdmmc.h +++ /dev/null @@ -1,125 +0,0 @@ - -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ -#ifndef __INCMVSysSdmmcAddrDech -#define __INCMVSysSdmmcAddrDech - -#include "mvCommon.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/sys/mvCpuIf.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _mvSdmmcDecWin -{ - MV_TARGET target; - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -} MV_SDMMC_DEC_WIN; - - -#define MV_SDMMC_MAX_ADDR_DECODE_WIN 4 - -#define MV_SDMMC_WIN_CTRL_REG(dev, win) (MV_SDIO_REG_BASE + 0x108 + ((win)<<3)) -#define MV_SDMMC_WIN_BASE_REG(dev, win) (MV_SDIO_REG_BASE + 0x10c + ((win)<<3)) - - -/* BITs in Windows 0-3 Control and Base Registers */ -#define MV_SDMMC_WIN_ENABLE_BIT 0 -#define MV_SDMMC_WIN_ENABLE_MASK (1<<MV_SDMMC_WIN_ENABLE_BIT) - -#define MV_SDMMC_WIN_TARGET_OFFSET 4 -#define MV_SDMMC_WIN_TARGET_MASK (0xF<<MV_SDMMC_WIN_TARGET_OFFSET) - -#define MV_SDMMC_WIN_ATTR_OFFSET 8 -#define MV_SDMMC_WIN_ATTR_MASK (0xFF<<MV_SDMMC_WIN_ATTR_OFFSET) - -#define MV_SDMMC_WIN_SIZE_OFFSET 16 -#define MV_SDMMC_WIN_SIZE_MASK (0xFFFF<<MV_SDMMC_WIN_SIZE_OFFSET) - -#define MV_SDMMC_WIN_BASE_OFFSET 16 -#define MV_SDMMC_WIN_BASE_MASK (0xFFFF<<MV_SDMMC_WIN_BASE_OFFSET) - -MV_STATUS mvSdmmcWinGet(int dev, MV_U32 winNum, MV_SDMMC_DEC_WIN *pAddrDecWin); -MV_STATUS mvSdmmcWinSet(int dev, MV_U32 winNum, MV_SDMMC_DEC_WIN *pAddrDecWin); -MV_STATUS mvSdmmcWinByTargetGet(MV_TARGET target, MV_SDMMC_DEC_WIN *pAddrDecWin); -MV_STATUS mvSdmmcWinInit(MV_VOID); -MV_VOID mvSdmmcAddrDecShow(MV_VOID); - - -#ifdef __cplusplus -} -#endif - - -#endif - - - - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTdm.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTdm.c deleted file mode 100644 index 6ac7f12bfc..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTdm.c +++ /dev/null @@ -1,462 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include "mvSysTdm.h" - - -/* defines */ -#ifdef MV_DEBUG - #define DB(x) x -#else - #define DB(x) -#endif - -static MV_TARGET tdmAddrDecPrioTap[] = -{ - PEX0_MEM, - SDRAM_CS0, - SDRAM_CS1, - SDRAM_CS2, - SDRAM_CS3, - DEVICE_CS0, - DEVICE_CS1, - DEVICE_CS2, - DEV_BOOCS, - PEX0_IO, - TBL_TERM -};
- -static MV_STATUS tdmWinOverlapDetect(MV_U32 winNum, MV_ADDR_WIN *pAddrWin); - -/******************************************************************************* -* mvTdmWinInit - Initialize TDM address decode windows -* -* DESCRIPTION: -* This function initialize TDM window decode unit. It set the -* default address decode -* windows of the unit. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if setting fail. -*******************************************************************************/ - -MV_STATUS mvTdmWinInit(void) -{ - MV_U32 winNum; - MV_U32 winPrioIndex = 0; - MV_CPU_DEC_WIN cpuAddrDecWin; - MV_TDM_DEC_WIN tdmWin; - MV_STATUS status; - - /*Disable all windows*/ - for (winNum = 0; winNum < TDM_MBUS_MAX_WIN; winNum++) - { - mvTdmWinEnable(winNum, MV_FALSE); - } - - for (winNum = 0; ((tdmAddrDecPrioTap[winPrioIndex] != TBL_TERM) && - (winNum < TDM_MBUS_MAX_WIN)); ) - { - status = mvCpuIfTargetWinGet(tdmAddrDecPrioTap[winPrioIndex], - &cpuAddrDecWin); - if (MV_NO_SUCH == status) - { - winPrioIndex++; - continue; - } - if (MV_OK != status) - { - mvOsPrintf("mvTdmInit: ERR. mvCpuIfTargetWinGet failed\n"); - return MV_ERROR; - } - - if (cpuAddrDecWin.enable == MV_TRUE) - { - tdmWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; - tdmWin.addrWin.baseLow = cpuAddrDecWin.addrWin.baseLow; - tdmWin.addrWin.size = cpuAddrDecWin.addrWin.size; - tdmWin.enable = MV_TRUE; - tdmWin.target = tdmAddrDecPrioTap[winPrioIndex]; - if (MV_OK != mvTdmWinSet(winNum, &tdmWin)) - { - return MV_ERROR; - } - winNum++; - } - winPrioIndex++; - } - return MV_OK; -} - -/******************************************************************************* -* mvTdmWinSet - Set TDM target address window -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) -* address window, also known as address decode window. -* After setting this target window, the TDM will be able to access the -* target within the address window. -* -* INPUT: -* winNum - TDM to target address decode window number. -* pAddrDecWin - TDM target window data structure. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if address window overlapps with other address decode windows. -* MV_BAD_PARAM if base address is invalid parameter or target is -* unknown. -* -*******************************************************************************/ - -MV_STATUS mvTdmWinSet(MV_U32 winNum, MV_TDM_DEC_WIN *pAddrDecWin) -{ - MV_TARGET_ATTRIB targetAttribs; - MV_DEC_REGS decRegs; - MV_U32 ctrlReg = 0; - - /* Parameter checking */ - if (winNum >= TDM_MBUS_MAX_WIN) - { - mvOsPrintf("mvTdmWinSet: ERR. Invalid win num %d\n",winNum); - return MV_BAD_PARAM; - } - - /* Check if the requested window overlapps with current windows */ - if (MV_TRUE == tdmWinOverlapDetect(winNum, &pAddrDecWin->addrWin)) - { - mvOsPrintf("mvTdmWinSet: ERR. Window %d overlap\n", winNum); - return MV_ERROR; - } - - /* check if address is aligned to the size */ - if (MV_IS_NOT_ALIGN(pAddrDecWin->addrWin.baseLow, pAddrDecWin->addrWin.size)) - { - mvOsPrintf("mvTdmWinSet: Error setting TDM window %d to "\ - "target %s.\nAddress 0x%08x is unaligned to size 0x%x.\n", - winNum, - mvCtrlTargetNameGet(pAddrDecWin->target), - pAddrDecWin->addrWin.baseLow, - pAddrDecWin->addrWin.size); - return MV_ERROR; - } - - decRegs.baseReg = MV_REG_READ(TDM_WIN_BASE_REG(winNum)); - decRegs.sizeReg = (MV_REG_READ(TDM_WIN_CTRL_REG(winNum)) & TDM_WIN_SIZE_MASK) >> TDM_WIN_SIZE_OFFS; - - if (MV_OK != mvCtrlAddrDecToReg(&(pAddrDecWin->addrWin),&decRegs)) - { - mvOsPrintf("mvTdmWinSet: mvCtrlAddrDecToReg Failed\n"); - return MV_ERROR; - } - - mvCtrlAttribGet(pAddrDecWin->target, &targetAttribs); - - /* for the safe side we disable the window before writing the new - values */ - mvTdmWinEnable(winNum, MV_FALSE); - - ctrlReg |= (targetAttribs.attrib << TDM_WIN_ATTRIB_OFFS); - ctrlReg |= (targetAttribs.targetId << TDM_WIN_TARGET_OFFS); - ctrlReg |= (decRegs.sizeReg & TDM_WIN_SIZE_MASK); - - /* Write to address base and control registers */ - MV_REG_WRITE(TDM_WIN_BASE_REG(winNum), decRegs.baseReg); - MV_REG_WRITE(TDM_WIN_CTRL_REG(winNum), ctrlReg); - /* Enable address decode target window */ - if (pAddrDecWin->enable == MV_TRUE) - { - mvTdmWinEnable(winNum, MV_TRUE); - } - return MV_OK; -} - -/******************************************************************************* -* mvTdmWinGet - Get peripheral target address window. -* -* DESCRIPTION: -* Get TDM peripheral target address window. -* -* INPUT: -* winNum - TDM to target address decode window number. -* -* OUTPUT: -* pAddrDecWin - TDM target window data structure. -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ - -MV_STATUS mvTdmWinGet(MV_U32 winNum, MV_TDM_DEC_WIN *pAddrDecWin) -{ - - MV_DEC_REGS decRegs; - MV_TARGET_ATTRIB targetAttrib; - - /* Parameter checking */ - if (winNum >= TDM_MBUS_MAX_WIN) - { - mvOsPrintf("mvTdmWinGet: ERR. Invalid winNum %d\n", winNum); - return MV_NOT_SUPPORTED; - } - - decRegs.baseReg = MV_REG_READ(TDM_WIN_BASE_REG(winNum)); - decRegs.sizeReg = (MV_REG_READ(TDM_WIN_CTRL_REG(winNum)) & TDM_WIN_SIZE_MASK) >> TDM_WIN_SIZE_OFFS; - - if (MV_OK != mvCtrlRegToAddrDec(&decRegs,&(pAddrDecWin->addrWin))) - { - mvOsPrintf("mvTdmWinGet: mvCtrlRegToAddrDec Failed \n"); - return MV_ERROR; - } - - /* attrib and targetId */ - targetAttrib.attrib = - (MV_REG_READ(TDM_WIN_CTRL_REG(winNum)) & TDM_WIN_ATTRIB_MASK) >> TDM_WIN_ATTRIB_OFFS; - targetAttrib.targetId = - (MV_REG_READ(TDM_WIN_CTRL_REG(winNum)) & TDM_WIN_TARGET_MASK) >> TDM_WIN_TARGET_OFFS; - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - /* Check if window is enabled */ - if (MV_REG_READ(TDM_WIN_CTRL_REG(winNum)) & TDM_WIN_ENABLE_MASK) - { - pAddrDecWin->enable = MV_TRUE; - } - else - { - pAddrDecWin->enable = MV_FALSE; - } - - return MV_OK; -} - -/******************************************************************************* -* mvTdmWinEnable - Enable/disable a TDM to target address window -* -* DESCRIPTION: -* This function enable/disable a TDM to target address window. -* According to parameter 'enable' the routine will enable the -* window, thus enabling TDM accesses (before enabling the window it is -* tested for overlapping). Otherwise, the window will be disabled. -* -* INPUT: -* winNum - TDM to target address decode window number. -* enable - Enable/disable parameter. -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_ERROR if decode window number was wrong or enabled window overlapps. -* -*******************************************************************************/ -MV_STATUS mvTdmWinEnable(int winNum, MV_BOOL enable) -{ - MV_TDM_DEC_WIN addrDecWin; - - if (MV_TRUE == enable) - { - if (winNum >= TDM_MBUS_MAX_WIN) - { - mvOsPrintf("mvTdmWinEnable:ERR. Invalid winNum%d\n",winNum); - return MV_ERROR; - } - - /* First check for overlap with other enabled windows */ - /* Get current window */ - if (MV_OK != mvTdmWinGet(winNum, &addrDecWin)) - { - mvOsPrintf("mvTdmWinEnable:ERR. targetWinGet fail\n"); - return MV_ERROR; - } - /* Check for overlapping */ - if (MV_FALSE == tdmWinOverlapDetect(winNum, &(addrDecWin.addrWin))) - { - /* No Overlap. Enable address decode target window */ - MV_REG_BIT_SET(TDM_WIN_CTRL_REG(winNum), TDM_WIN_ENABLE_MASK); - } - else - { /* Overlap detected */ - mvOsPrintf("mvTdmWinEnable:ERR. Overlap detected\n"); - return MV_ERROR; - } - } - else - { - MV_REG_BIT_RESET(TDM_WIN_CTRL_REG(winNum), TDM_WIN_ENABLE_MASK); - } - return MV_OK; -} - - -/******************************************************************************* -* tdmWinOverlapDetect - Detect TDM address windows overlapping -* -* DESCRIPTION: -* An unpredicted behaviour is expected in case TDM address decode -* windows overlapps. -* This function detects TDM address decode windows overlapping of a -* specified window. The function does not check the window itself for -* overlapping. The function also skipps disabled address decode windows. -* -* INPUT: -* winNum - address decode window number. -* pAddrDecWin - An address decode window struct. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data -* from registers. -* -*******************************************************************************/ -static MV_STATUS tdmWinOverlapDetect(MV_U32 winNum, MV_ADDR_WIN *pAddrWin) -{ - MV_U32 winNumIndex; - MV_TDM_DEC_WIN addrDecWin; - - for (winNumIndex = 0; winNumIndex < TDM_MBUS_MAX_WIN; winNumIndex++) - { - /* Do not check window itself */ - if (winNumIndex == winNum) - { - continue; - } - /* Do not check disabled windows */ - if (MV_REG_READ(TDM_WIN_CTRL_REG(winNum)) & TDM_WIN_ENABLE_MASK) - { - /* Get window parameters */ - if (MV_OK != mvTdmWinGet(winNumIndex, &addrDecWin)) - { - DB(mvOsPrintf("dmaWinOverlapDetect: ERR. TargetWinGet failed\n")); - return MV_ERROR; - } - - if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin))) - { - return MV_TRUE; - } - } - } - return MV_FALSE; -} - -/******************************************************************************* -* mvTdmAddrDecShow - Print the TDM address decode map. -* -* DESCRIPTION: -* This function print the TDM address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvTdmAddrDecShow(MV_VOID) -{ - MV_TDM_DEC_WIN win; - int i; - - mvOsOutput( "\n" ); - mvOsOutput( "TDM:\n" ); - mvOsOutput( "----\n" ); - - for( i = 0; i < TDM_MBUS_MAX_WIN; i++ ) - { - memset( &win, 0, sizeof(MV_TDM_DEC_WIN) ); - - mvOsOutput( "win%d - ", i ); - - if (mvTdmWinGet(i, &win ) == MV_OK ) - { - if( win.enable ) - { - mvOsOutput( "%s base %08x, ", - mvCtrlTargetNameGet(win.target), win.addrWin.baseLow); - mvOsOutput( "...." ); - mvSizePrint( win.addrWin.size ); - mvOsOutput( "\n" ); - } - else - mvOsOutput( "disable\n" ); - } - } -} - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTdm.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTdm.h deleted file mode 100644 index 0d3140f5e4..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTdm.h +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCmvSysTdmh -#define __INCmvSysTdmh - -#include "ctrlEnv/sys/mvCpuIf.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/mvCtrlEnvAddrDec.h" - -typedef struct _mvTdmDecWin -{ - MV_TARGET target; - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ -} MV_TDM_DEC_WIN; - -MV_STATUS mvTdmWinInit(MV_VOID); -MV_STATUS mvTdmWinSet(MV_U32 winNum, MV_TDM_DEC_WIN *pAddrDecWin); -MV_STATUS mvTdmWinGet(MV_U32 winNum, MV_TDM_DEC_WIN *pAddrDecWin); -MV_STATUS mvTdmWinEnable(int winNum, MV_BOOL enable); -MV_VOID mvTdmAddrDecShow(MV_VOID); - - -#define TDM_MBUS_MAX_WIN 4 -#define TDM_WIN_CTRL_REG(win) ((TDM_REG_BASE + 0x4030) + (win<<4)) -#define TDM_WIN_BASE_REG(win) ((TDM_REG_BASE +0x4034) + (win<<4)) - -/* TDM_WIN_CTRL_REG bits */ -#define TDM_WIN_ENABLE_OFFS 0 -#define TDM_WIN_ENABLE_MASK (1<<TDM_WIN_ENABLE_OFFS) -#define TDM_WIN_ENABLE 1 -#define TDM_WIN_TARGET_OFFS 4 -#define TDM_WIN_TARGET_MASK (0xf<<TDM_WIN_TARGET_OFFS) -#define TDM_WIN_ATTRIB_OFFS 8 -#define TDM_WIN_ATTRIB_MASK (0xff<<TDM_WIN_ATTRIB_OFFS) -#define TDM_WIN_SIZE_OFFS 16 -#define TDM_WIN_SIZE_MASK (0xffff<<TDM_WIN_SIZE_OFFS) - -/* TDM_WIN_BASE_REG bits */ -#define TDM_BASE_OFFS 16 -#define TDM_BASE_MASK (0xffff<<TDM_BASE_OFFS) - -#endif /*__INCmvSysTdmh*/ - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTs.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTs.c deleted file mode 100644 index 4415c7c265..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTs.c +++ /dev/null @@ -1,591 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - - -#include "ctrlEnv/sys/mvSysTs.h" - - -typedef struct _mvTsuDecWin -{ - MV_TARGET target; - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -}MV_TSU_DEC_WIN; - - -MV_TARGET tsuAddrDecPrioTap[] = -{ -#if defined(MV_INCLUDE_PEX) - PEX0_MEM, -#endif -#if defined(MV_INCLUDE_PCI) - PCI0_MEM, -#endif -#if defined(MV_INCLUDE_SDRAM_CS0) - SDRAM_CS0, -#endif -#if defined(MV_INCLUDE_SDRAM_CS1) - SDRAM_CS1, -#endif -#if defined(MV_INCLUDE_SDRAM_CS2) - SDRAM_CS2, -#endif -#if defined(MV_INCLUDE_SDRAM_CS3) - SDRAM_CS3, -#endif -#if defined(MV_INCLUDE_DEVICE_CS0) - DEVICE_CS0, -#endif -#if defined(MV_INCLUDE_DEVICE_CS1) - DEVICE_CS1, -#endif -#if defined(MV_INCLUDE_DEVICE_CS2) - DEVICE_CS2, -#endif -#if defined(MV_INCLUDE_DEVICE_CS3) - DEVICE_CS3, -#endif -#if defined(MV_INCLUDE_PEX) - PEX0_IO, -#endif -#if defined(MV_INCLUDE_PCI) - PCI0_IO, -#endif - TBL_TERM -}; - -static MV_STATUS tsuWinOverlapDetect(MV_U32 winNum, MV_ADDR_WIN *pAddrWin); -static MV_STATUS mvTsuWinSet(MV_U32 winNum, MV_TSU_DEC_WIN *pAddrDecWin); -static MV_STATUS mvTsuWinGet(MV_U32 winNum, MV_TSU_DEC_WIN *pAddrDecWin); -MV_STATUS mvTsuWinEnable(MV_U32 winNum,MV_BOOL enable); - -/******************************************************************************* -* mvTsuWinInit -* -* DESCRIPTION: -* Initialize the TSU unit address decode windows. -* -* INPUT: -* None. -* OUTPUT: -* None. -* RETURN: -* MV_OK - on success, -* -*******************************************************************************/ -MV_STATUS mvTsuWinInit(void) -{ - MV_U32 winNum, status, winPrioIndex=0; - MV_TSU_DEC_WIN tsuWin; - MV_CPU_DEC_WIN cpuAddrDecWin; - - /* First disable all address decode windows */ - for(winNum = 0; winNum < TSU_MAX_DECODE_WIN; winNum++) - { - MV_REG_BIT_RESET(MV_TSU_WIN_CTRL_REG(winNum), - TSU_WIN_CTRL_EN_MASK); - } - - /* Go through all windows in user table until table terminator */ - for(winNum = 0; ((tsuAddrDecPrioTap[winPrioIndex] != TBL_TERM) && - (winNum < TSU_MAX_DECODE_WIN));) - { - /* first get attributes from CPU If */ - status = mvCpuIfTargetWinGet(tsuAddrDecPrioTap[winPrioIndex], - &cpuAddrDecWin); - - if(MV_NO_SUCH == status) - { - winPrioIndex++; - continue; - } - if(MV_OK != status) - { - mvOsPrintf("mvTsuWinInit: ERR. mvCpuIfTargetWinGet failed\n"); - return MV_ERROR; - } - - if (cpuAddrDecWin.enable == MV_TRUE) - { - tsuWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; - tsuWin.addrWin.baseLow = cpuAddrDecWin.addrWin.baseLow; - tsuWin.addrWin.size = cpuAddrDecWin.addrWin.size; - tsuWin.enable = MV_TRUE; - tsuWin.target = tsuAddrDecPrioTap[winPrioIndex]; - - if(MV_OK != mvTsuWinSet(winNum, &tsuWin)) - { - mvOsPrintf("mvTsuWinInit: ERR. mvTsuWinSet failed winNum=%d\n", - winNum); - return MV_ERROR; - } - winNum++; - } - winPrioIndex ++; - } - - return MV_OK; -} - - -/******************************************************************************* -* mvTsuWinSet -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) -* address window, also known as address decode window. -* After setting this target window, the TSU will be able to access the -* target within the address window. -* -* INPUT: -* winNum - TSU to target address decode window number. -* pAddrDecWin - TSU target window data structure. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR - if address window overlapps with other address decode -* windows. -* MV_BAD_PARAM - if base address is invalid parameter or target is -* unknown. -* -*******************************************************************************/ -MV_STATUS mvTsuWinSet(MV_U32 winNum, MV_TSU_DEC_WIN *pAddrDecWin) -{ - MV_TARGET_ATTRIB targetAttribs; - MV_DEC_REGS decRegs; - - /* Parameter checking */ - if(winNum >= TSU_MAX_DECODE_WIN) - { - mvOsPrintf("mvTsuWinSet: ERR. Invalid win num %d\n",winNum); - return MV_BAD_PARAM; - } - - /* Check if the requested window overlapps with current windows */ - if(MV_TRUE == tsuWinOverlapDetect(winNum, &pAddrDecWin->addrWin)) - { - mvOsPrintf("mvTsuWinSet: ERR. Window %d overlap\n", winNum); - return MV_ERROR; - } - - /* check if address is aligned to the size */ - if(MV_IS_NOT_ALIGN(pAddrDecWin->addrWin.baseLow,pAddrDecWin->addrWin.size)) - { - mvOsPrintf("mvTsuWinSet: Error setting TSU window %d to target " - "%s.\nAddress 0x%08x is unaligned to size 0x%x.\n", - winNum, mvCtrlTargetNameGet(pAddrDecWin->target), - pAddrDecWin->addrWin.baseLow, - pAddrDecWin->addrWin.size); - return MV_ERROR; - } - - decRegs.baseReg = MV_REG_READ(MV_TSU_WIN_BASE_REG(winNum)); - decRegs.sizeReg = MV_REG_READ(MV_TSU_WIN_CTRL_REG(winNum)); - - if(MV_OK != mvCtrlAddrDecToReg(&(pAddrDecWin->addrWin),&decRegs)) - { - mvOsPrintf("mvTsuWinSet: mvCtrlAddrDecToReg Failed\n"); - return MV_ERROR; - } - - mvCtrlAttribGet(pAddrDecWin->target,&targetAttribs); - - /* set attributes */ - decRegs.sizeReg &= ~TSU_WIN_CTRL_ATTR_MASK; - decRegs.sizeReg |= targetAttribs.attrib << TSU_WIN_CTRL_ATTR_OFFS; - /* set target ID */ - decRegs.sizeReg &= ~TSU_WIN_CTRL_TARGET_MASK; - decRegs.sizeReg |= targetAttribs.targetId << TSU_WIN_CTRL_TARGET_OFFS; - - /* for the safe side we disable the window before writing the new */ - /* values */ - mvTsuWinEnable(winNum, MV_FALSE); - MV_REG_WRITE(MV_TSU_WIN_CTRL_REG(winNum),decRegs.sizeReg); - - /* Write to address decode Size Register */ - MV_REG_WRITE(MV_TSU_WIN_BASE_REG(winNum), decRegs.baseReg); - - /* Enable address decode target window */ - if(pAddrDecWin->enable == MV_TRUE) - { - mvTsuWinEnable(winNum,MV_TRUE); - } - - return MV_OK; -} - - -/******************************************************************************* -* mvTsuWinGet -* -* DESCRIPTION: -* Get TSU peripheral target address window. -* -* INPUT: -* winNum - TSU to target address decode window number. -* -* OUTPUT: -* pAddrDecWin - TSU target window data structure. -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvTsuWinGet(MV_U32 winNum, MV_TSU_DEC_WIN *pAddrDecWin) -{ - MV_DEC_REGS decRegs; - MV_TARGET_ATTRIB targetAttrib; - - /* Parameter checking */ - if(winNum >= TSU_MAX_DECODE_WIN) - { - mvOsPrintf("mvTsuWinGet: ERR. Invalid winNum %d\n", winNum); - return MV_NOT_SUPPORTED; - } - - decRegs.baseReg = MV_REG_READ(MV_TSU_WIN_BASE_REG(winNum)); - decRegs.sizeReg = MV_REG_READ(MV_TSU_WIN_CTRL_REG(winNum)); - - if(MV_OK != mvCtrlRegToAddrDec(&decRegs,&(pAddrDecWin->addrWin))) - { - mvOsPrintf("mvTsuWinGet: mvCtrlRegToAddrDec Failed \n"); - return MV_ERROR; - } - - /* attrib and targetId */ - targetAttrib.attrib = - (decRegs.sizeReg & TSU_WIN_CTRL_ATTR_MASK) >> TSU_WIN_CTRL_ATTR_OFFS; - targetAttrib.targetId = - (decRegs.sizeReg & TSU_WIN_CTRL_TARGET_MASK) >> TSU_WIN_CTRL_TARGET_OFFS; - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - /* Check if window is enabled */ - if((MV_REG_READ(MV_TSU_WIN_CTRL_REG(winNum)) & TSU_WIN_CTRL_EN_MASK)) - { - pAddrDecWin->enable = MV_TRUE; - } - else - { - pAddrDecWin->enable = MV_FALSE; - } - - return MV_OK; -} - - -/******************************************************************************* -* mvTsuWinEnable -* -* DESCRIPTION: -* This function enable/disable a TSU to target address window. -* According to parameter 'enable' the routine will enable the -* window, thus enabling TSU accesses (before enabling the window it is -* tested for overlapping). Otherwise, the window will be disabled. -* -* INPUT: -* winNum - TSU to target address decode window number. -* enable - Enable / disable parameter. -* -* OUTPUT: -* N/A -* -* RETURN: -* MV_ERROR if decode window number was wrong or enabled window overlapps. -* -*******************************************************************************/ -MV_STATUS mvTsuWinEnable(MV_U32 winNum,MV_BOOL enable) -{ - MV_TSU_DEC_WIN addrDecWin; - - /* Parameter checking */ - if(winNum >= TSU_MAX_DECODE_WIN) - { - mvOsPrintf("mvTsuWinEnable: ERR. Invalid winNum%d\n",winNum); - return MV_ERROR; - } - - if(enable == MV_TRUE) - { - /* First check for overlap with other enabled windows */ - /* Get current window. */ - if(MV_OK != mvTsuWinGet(winNum,&addrDecWin)) - { - mvOsPrintf("mvTsuWinEnable: ERR. targetWinGet fail\n"); - return MV_ERROR; - } - /* Check for overlapping. */ - if(MV_FALSE == tsuWinOverlapDetect(winNum,&(addrDecWin.addrWin))) - { - /* No Overlap. Enable address decode target window */ - MV_REG_BIT_SET(MV_TSU_WIN_CTRL_REG(winNum), - TSU_WIN_CTRL_EN_MASK); - } - else - { - /* Overlap detected */ - mvOsPrintf("mvTsuWinEnable: ERR. Overlap detected\n"); - return MV_ERROR; - } - } - else - { - /* Disable address decode target window */ - MV_REG_BIT_RESET(MV_TSU_WIN_CTRL_REG(winNum), - TSU_WIN_CTRL_EN_MASK); - } - return MV_OK; -} - -/******************************************************************************* -* mvTsuWinTargetGet -* -* DESCRIPTION: -* Get Window number associated with target -* -* INPUT: -* target - Target ID to get the window number for. -* OUTPUT: -* -* RETURN: -* window number or 0xFFFFFFFF on error. -* -*******************************************************************************/ -MV_U32 mvTsuWinTargetGet(MV_TARGET target) -{ - MV_TSU_DEC_WIN decWin; - MV_U32 winNum; - - /* Check parameters */ - if(target >= MAX_TARGETS) - { - mvOsPrintf("mvTsuWinTargetGet: target %d is Illigal\n", target); - return 0xffffffff; - } - - for(winNum = 0; winNum < TSU_MAX_DECODE_WIN; winNum++) - { - if(mvTsuWinGet(winNum,&decWin) != MV_OK) - { - mvOsPrintf("mvTsuWinGet: window returned error\n"); - return 0xffffffff; - } - - if (decWin.enable == MV_TRUE) - { - if(decWin.target == target) - { - return winNum; - } - } - } - return 0xFFFFFFFF; -} - - -/******************************************************************************* -* tsuWinOverlapDetect -* -* DESCRIPTION: -* Detect TSU address windows overlapping -* An unpredicted behaviur is expected in case TSU address decode -* windows overlapps. -* This function detects TSU address decode windows overlapping of a -* specified window. The function does not check the window itself for -* overlapping. The function also skipps disabled address decode windows. -* -* INPUT: -* winNum - address decode window number. -* pAddrDecWin - An address decode window struct. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data -* from registers. -* -*******************************************************************************/ -static MV_STATUS tsuWinOverlapDetect(MV_U32 winNum, MV_ADDR_WIN *pAddrWin) -{ - MV_U32 ctrlReg; - MV_U32 winNumIndex; - MV_TSU_DEC_WIN addrDecWin; - - for(winNumIndex = 0; winNumIndex < TSU_MAX_DECODE_WIN; winNumIndex++) - { - /* Do not check window itself */ - if(winNumIndex == winNum) - { - continue; - } - - /* Do not check disabled windows */ - ctrlReg = MV_REG_READ(MV_TSU_WIN_CTRL_REG(winNumIndex)); - if((ctrlReg & TSU_WIN_CTRL_EN_MASK) == 0) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvTsuWinGet(winNumIndex, &addrDecWin)) - { - mvOsPrintf("tsuWinOverlapDetect: ERR. mvTsuWinGet failed\n"); - return MV_ERROR; - } - - if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin))) - { - return MV_TRUE; - } - } - return MV_FALSE; -} - - -/******************************************************************************* -* mvTsuAddrDecShow -* -* DESCRIPTION: -* Print the TSU address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -void mvTsuAddrDecShow(void) -{ - MV_TSU_DEC_WIN win; - int i; - - if (MV_FALSE == mvCtrlPwrClckGet(TS_UNIT_ID, 0)) - return; - - mvOsOutput( "\n" ); - mvOsOutput( "TSU:\n"); - mvOsOutput( "----\n" ); - - for(i = 0; i < TSU_MAX_DECODE_WIN; i++) - { - memset(&win, 0, sizeof(TSU_MAX_DECODE_WIN)); - mvOsOutput( "win%d - ", i ); - - if(mvTsuWinGet(i, &win ) == MV_OK ) - { - if(win.enable == MV_TRUE) - { - mvOsOutput("%s base %08x, ", - mvCtrlTargetNameGet(win.target), - win.addrWin.baseLow); - mvOsOutput( "...." ); - mvSizePrint(win.addrWin.size ); - mvOsOutput( "\n" ); - } - else - { - mvOsOutput( "disable\n" ); - } - } - } - return; -} - - -/******************************************************************************* -* mvTsuInit -* -* DESCRIPTION: -* Initialize the TSU unit, and get unit out of reset. -* -* INPUT: -* coreClock - The core clock at which the TSU should operate. -* mode - The mode on configure the unit into (serial/parallel). -* memHandle - Memory handle used for memory allocations. -* OUTPUT: -* None. -* RETURN: -* MV_OK - on success, -* -*******************************************************************************/ -MV_STATUS mvTsuInit(MV_TSU_CORE_CLOCK coreClock, MV_TSU_PORTS_MODE mode, - void *osHandle) -{ - MV_STATUS status; - - status = mvTsuWinInit(); - if(status == MV_OK) - status = mvTsuHalInit(coreClock,mode,osHandle); - - return status; -} diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTs.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTs.h deleted file mode 100644 index 42825893cd..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysTs.h +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCmvSysTsh -#define __INCmvSysTsh - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* includes */ -#include "ts/mvTsu.h" -#include "ctrlEnv/sys/mvCpuIf.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/mvCtrlEnvAddrDec.h" - -#define TSU_MAX_DECODE_WIN 4 - - -/*******************************************/ -/* TSU Windows Registers */ -/*******************************************/ -#define MV_TSU_WIN_CTRL_REG(win) (TSU_GLOBAL_REG_BASE +0x30 + 0x10 * win) -#define MV_TSU_WIN_BASE_REG(win) (TSU_GLOBAL_REG_BASE +0x34 + 0x10 * win) - -/* TSU windows control register. */ -#define TSU_WIN_CTRL_EN_MASK (0x1 << 0) -#define TSU_WIN_CTRL_TARGET_OFFS 4 -#define TSU_WIN_CTRL_TARGET_MASK (0xF << TSU_WIN_CTRL_TARGET_OFFS) -#define TSU_WIN_CTRL_ATTR_OFFS 8 -#define TSU_WIN_CTRL_ATTR_MASK (0xFF << TSU_WIN_CTRL_ATTR_OFFS) -#define TSU_WIN_CTRL_SIZE_OFFS 16 -#define TSU_WIN_CTRL_SIZE_MASK (0xFFFF << TSU_WIN_CTRL_SIZE_OFFS) - -/* TSU windows base register. */ -#define TSU_WIN_BASE_OFFS 16 -#define TSU_WIN_BASE_MASK (0xFFFF << TSU_WIN_BASE_OFFS) - -MV_STATUS mvTsuWinInit(void); - -void mvTsuAddrDecShow(void); -MV_STATUS mvTsuInit(MV_TSU_CORE_CLOCK coreClock, MV_TSU_PORTS_MODE mode, - void *osHandle); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __INCmvTsh */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysUsb.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysUsb.c deleted file mode 100644 index 195b5e13e3..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysUsb.c +++ /dev/null @@ -1,497 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include "ctrlEnv/sys/mvSysUsb.h" - -MV_TARGET usbAddrDecPrioTab[] = -{ -#if defined(MV_INCLUDE_SDRAM_CS0) - SDRAM_CS0, -#endif -#if defined(MV_INCLUDE_SDRAM_CS1) - SDRAM_CS1, -#endif -#if defined(MV_INCLUDE_SDRAM_CS2) - SDRAM_CS2, -#endif -#if defined(MV_INCLUDE_SDRAM_CS3) - SDRAM_CS3, -#endif -#if defined(MV_INCLUDE_CESA) && defined(USB_UNDERRUN_WA) - CRYPT_ENG, -#endif -#if defined(MV_INCLUDE_PEX) - PEX0_MEM, -#endif - TBL_TERM -}; - - - -MV_STATUS mvUsbInit(int dev, MV_BOOL isHost) -{ - MV_STATUS status; - - status = mvUsbWinInit(dev); - if(status != MV_OK) - return status; - - return mvUsbHalInit(dev, isHost); -} - - -/******************************************************************************* -* usbWinOverlapDetect - Detect USB address windows overlapping -* -* DESCRIPTION: -* An unpredicted behaviur is expected in case USB address decode -* windows overlapps. -* This function detects USB address decode windows overlapping of a -* specified window. The function does not check the window itself for -* overlapping. The function also skipps disabled address decode windows. -* -* INPUT: -* winNum - address decode window number. -* pAddrDecWin - An address decode window struct. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data -* from registers. -* -*******************************************************************************/ -static MV_STATUS usbWinOverlapDetect(int dev, MV_U32 winNum, - MV_ADDR_WIN *pAddrWin) -{ - MV_U32 winNumIndex; - MV_DEC_WIN addrDecWin; - - for(winNumIndex=0; winNumIndex<MV_USB_MAX_ADDR_DECODE_WIN; winNumIndex++) - { - /* Do not check window itself */ - if (winNumIndex == winNum) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvUsbWinGet(dev, winNumIndex, &addrDecWin)) - { - mvOsPrintf("%s: ERR. TargetWinGet failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* Do not check disabled windows */ - if(addrDecWin.enable == MV_FALSE) - { - continue; - } - - if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin))) - { - return MV_TRUE; - } - } - return MV_FALSE; -} - -/******************************************************************************* -* mvUsbWinSet - Set USB target address window -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) -* address window, also known as address decode window. -* After setting this target window, the USB will be able to access the -* target within the address window. -* -* INPUT: -* winNum - USB target address decode window number. -* pAddrDecWin - USB target window data structure. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_ERROR if address window overlapps with other address decode windows. -* MV_BAD_PARAM if base address is invalid parameter or target is -* unknown. -* -*******************************************************************************/ -MV_STATUS mvUsbWinSet(int dev, MV_U32 winNum, MV_DEC_WIN *pDecWin) -{ - MV_DEC_WIN_PARAMS winParams; - MV_U32 sizeReg, baseReg; - - /* Parameter checking */ - if (winNum >= MV_USB_MAX_ADDR_DECODE_WIN) - { - mvOsPrintf("%s: ERR. Invalid win num %d\n",__FUNCTION__, winNum); - return MV_BAD_PARAM; - } - - /* Check if the requested window overlapps with current windows */ - if (MV_TRUE == usbWinOverlapDetect(dev, winNum, &pDecWin->addrWin)) - { - mvOsPrintf("%s: ERR. Window %d overlap\n", __FUNCTION__, winNum); - return MV_ERROR; - } - - /* check if address is aligned to the size */ - if(MV_IS_NOT_ALIGN(pDecWin->addrWin.baseLow, pDecWin->addrWin.size)) - { - mvOsPrintf("mvUsbWinSet:Error setting USB window %d to "\ - "target %s.\nAddress 0x%08x is unaligned to size 0x%x.\n", - winNum, - mvCtrlTargetNameGet(pDecWin->target), - pDecWin->addrWin.baseLow, - pDecWin->addrWin.size); - return MV_ERROR; - } - - if(MV_OK != mvCtrlAddrDecToParams(pDecWin, &winParams)) - { - mvOsPrintf("%s: mvCtrlAddrDecToParams Failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* set Size, Attributes and TargetID */ - sizeReg = (((winParams.targetId << MV_USB_WIN_TARGET_OFFSET) & MV_USB_WIN_TARGET_MASK) | - ((winParams.attrib << MV_USB_WIN_ATTR_OFFSET) & MV_USB_WIN_ATTR_MASK) | - ((winParams.size << MV_USB_WIN_SIZE_OFFSET) & MV_USB_WIN_SIZE_MASK)); - -#if defined(MV645xx) || defined(MV646xx) - /* If window is DRAM with HW cache coherency, make sure bit2 is set */ - sizeReg &= ~MV_USB_WIN_BURST_WR_LIMIT_MASK; - - if((MV_TARGET_IS_DRAM(pDecWin->target)) && - (pDecWin->addrWinAttr.cachePolicy != NO_COHERENCY)) - { - sizeReg |= MV_USB_WIN_BURST_WR_32BIT_LIMIT; - } - else - { - sizeReg |= MV_USB_WIN_BURST_WR_NO_LIMIT; - } -#endif /* MV645xx || MV646xx */ - - if (pDecWin->enable == MV_TRUE) - { - sizeReg |= MV_USB_WIN_ENABLE_MASK; - } - else - { - sizeReg &= ~MV_USB_WIN_ENABLE_MASK; - } - - /* Update Base value */ - baseReg = (winParams.baseAddr & MV_USB_WIN_BASE_MASK); - - MV_REG_WRITE( MV_USB_WIN_CTRL_REG(dev, winNum), sizeReg); - MV_REG_WRITE( MV_USB_WIN_BASE_REG(dev, winNum), baseReg); - - return MV_OK; -} - -/******************************************************************************* -* mvUsbWinGet - Get USB peripheral target address window. -* -* DESCRIPTION: -* Get USB peripheral target address window. -* -* INPUT: -* winNum - USB target address decode window number. -* -* OUTPUT: -* pDecWin - USB target window data structure. -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvUsbWinGet(int dev, MV_U32 winNum, MV_DEC_WIN *pDecWin) -{ - MV_DEC_WIN_PARAMS winParam; - MV_U32 sizeReg, baseReg; - - /* Parameter checking */ - if (winNum >= MV_USB_MAX_ADDR_DECODE_WIN) - { - mvOsPrintf("%s (dev=%d): ERR. Invalid winNum %d\n", - __FUNCTION__, dev, winNum); - return MV_NOT_SUPPORTED; - } - - baseReg = MV_REG_READ( MV_USB_WIN_BASE_REG(dev, winNum) ); - sizeReg = MV_REG_READ( MV_USB_WIN_CTRL_REG(dev, winNum) ); - - /* Check if window is enabled */ - if(sizeReg & MV_USB_WIN_ENABLE_MASK) - { - pDecWin->enable = MV_TRUE; - - /* Extract window parameters from registers */ - winParam.targetId = (sizeReg & MV_USB_WIN_TARGET_MASK) >> MV_USB_WIN_TARGET_OFFSET; - winParam.attrib = (sizeReg & MV_USB_WIN_ATTR_MASK) >> MV_USB_WIN_ATTR_OFFSET; - winParam.size = (sizeReg & MV_USB_WIN_SIZE_MASK) >> MV_USB_WIN_SIZE_OFFSET; - winParam.baseAddr = (baseReg & MV_USB_WIN_BASE_MASK); - - /* Translate the decode window parameters to address decode struct */ - if (MV_OK != mvCtrlParamsToAddrDec(&winParam, pDecWin)) - { - mvOsPrintf("Failed to translate register parameters to USB address" \ - " decode window structure\n"); - return MV_ERROR; - } - } - else - { - pDecWin->enable = MV_FALSE; - } - return MV_OK; -} - -/******************************************************************************* -* mvUsbWinInit - -* -* INPUT: -* -* OUTPUT: -* -* RETURN: -* MV_ERROR if register parameters are invalid. -* -*******************************************************************************/ -MV_STATUS mvUsbWinInit(int dev) -{ - MV_STATUS status; - MV_DEC_WIN usbWin; - MV_CPU_DEC_WIN cpuAddrDecWin; - int winNum; - MV_U32 winPrioIndex = 0; - - /* First disable all address decode windows */ - for(winNum = 0; winNum < MV_USB_MAX_ADDR_DECODE_WIN; winNum++) - { - MV_REG_BIT_RESET(MV_USB_WIN_CTRL_REG(dev, winNum), MV_USB_WIN_ENABLE_MASK); - } - - /* Go through all windows in user table until table terminator */ - winNum = 0; - while( (usbAddrDecPrioTab[winPrioIndex] != TBL_TERM) && - (winNum < MV_USB_MAX_ADDR_DECODE_WIN) ) - { - /* first get attributes from CPU If */ - status = mvCpuIfTargetWinGet(usbAddrDecPrioTab[winPrioIndex], - &cpuAddrDecWin); - - if(MV_NO_SUCH == status) - { - winPrioIndex++; - continue; - } - if (MV_OK != status) - { - mvOsPrintf("%s: ERR. mvCpuIfTargetWinGet failed\n", __FUNCTION__); - return MV_ERROR; - } - - if (cpuAddrDecWin.enable == MV_TRUE) - { - usbWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; - usbWin.addrWin.baseLow = cpuAddrDecWin.addrWin.baseLow; - usbWin.addrWin.size = cpuAddrDecWin.addrWin.size; - usbWin.enable = MV_TRUE; - usbWin.target = usbAddrDecPrioTab[winPrioIndex]; - -#if defined(MV645xx) || defined(MV646xx) - /* Get the default attributes for that target window */ - mvCtrlDefAttribGet(usbWin.target, &usbWin.addrWinAttr); -#endif /* MV645xx || MV646xx */ - - if(MV_OK != mvUsbWinSet(dev, winNum, &usbWin)) - { - return MV_ERROR; - } - winNum++; - } - winPrioIndex++; - } - return MV_OK; -} - -/******************************************************************************* -* mvUsbAddrDecShow - Print the USB address decode map. -* -* DESCRIPTION: -* This function print the USB address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvUsbAddrDecShow(MV_VOID) -{ - MV_DEC_WIN addrDecWin; - int i, winNum; - - mvOsOutput( "\n" ); - mvOsOutput( "USB:\n" ); - mvOsOutput( "----\n" ); - - for(i=0; i<mvCtrlUsbMaxGet(); i++) - { - mvOsOutput( "Device %d:\n", i); - - for(winNum = 0; winNum < MV_USB_MAX_ADDR_DECODE_WIN; winNum++) - { - memset(&addrDecWin, 0, sizeof(MV_DEC_WIN) ); - - mvOsOutput( "win%d - ", winNum ); - - if( mvUsbWinGet(i, winNum, &addrDecWin ) == MV_OK ) - { - if( addrDecWin.enable ) - { - mvOsOutput( "%s base %08x, ", - mvCtrlTargetNameGet(addrDecWin.target), addrDecWin.addrWin.baseLow ); - - mvSizePrint( addrDecWin.addrWin.size ); - -#if defined(MV645xx) || defined(MV646xx) - switch( addrDecWin.addrWinAttr.swapType) - { - case MV_BYTE_SWAP: - mvOsOutput( "BYTE_SWAP, " ); - break; - case MV_NO_SWAP: - mvOsOutput( "NO_SWAP , " ); - break; - case MV_BYTE_WORD_SWAP: - mvOsOutput( "BYTE_WORD_SWAP, " ); - break; - case MV_WORD_SWAP: - mvOsOutput( "WORD_SWAP, " ); - break; - default: - mvOsOutput( "SWAP N/A , " ); - } - - switch( addrDecWin.addrWinAttr.cachePolicy ) - { - case NO_COHERENCY: - mvOsOutput( "NO_COHERENCY , " ); - break; - case WT_COHERENCY: - mvOsOutput( "WT_COHERENCY , " ); - break; - case WB_COHERENCY: - mvOsOutput( "WB_COHERENCY , " ); - break; - default: - mvOsOutput( "COHERENCY N/A, " ); - } - - switch( addrDecWin.addrWinAttr.pcixNoSnoop ) - { - case 0: - mvOsOutput( "PCI-X NS inactive, " ); - break; - case 1: - mvOsOutput( "PCI-X NS active , " ); - break; - default: - mvOsOutput( "PCI-X NS N/A , " ); - } - - switch( addrDecWin.addrWinAttr.p2pReq64 ) - { - case 0: - mvOsOutput( "REQ64 force" ); - break; - case 1: - mvOsOutput( "REQ64 detect" ); - break; - default: - mvOsOutput( "REQ64 N/A" ); - } -#endif /* MV645xx || MV646xx */ - mvOsOutput( "\n" ); - } - else - mvOsOutput( "disable\n" ); - } - } - } -} - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysUsb.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysUsb.h deleted file mode 100644 index 07f98de9c9..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysUsb.h +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCmvSysUsbh -#define __INCmvSysUsbh - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* includes */ -#include "usb/mvUsb.h" -#include "ctrlEnv/sys/mvCpuIf.h" -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/mvCtrlEnvAddrDec.h" - -#define MV_USB_MAX_ADDR_DECODE_WIN 4 - -/*******************************************/ -/* USB Bridge Registers */ -/*******************************************/ -#define MV_USB_BRIDGE_CTRL_REG(dev) (USB_REG_BASE(dev) + 0x300) - -#define MV_USB_WIN_CTRL_REG(dev, win) (USB_REG_BASE(dev) + 0x320 + ((win)<<4)) -#define MV_USB_WIN_BASE_REG(dev, win) (USB_REG_BASE(dev) + 0x324 + ((win)<<4)) - -/* BITs in Windows 0-3 Control and Base Registers */ -#define MV_USB_WIN_ENABLE_BIT 0 -#define MV_USB_WIN_ENABLE_MASK (1 << MV_USB_WIN_ENABLE_BIT) - -#define MV_USB_WIN_BURST_WR_LIMIT_BIT 1 -#define MV_USB_WIN_BURST_WR_LIMIT_MASK (1 << MV_USB_WIN_BURST_WR_LIMIT_BIT) -#define MV_USB_WIN_BURST_WR_NO_LIMIT (0 << MV_USB_WIN_BURST_WR_LIMIT_BIT) -#define MV_USB_WIN_BURST_WR_32BIT_LIMIT (1 << MV_USB_WIN_BURST_WR_LIMIT_BIT) - -#define MV_USB_WIN_TARGET_OFFSET 4 -#define MV_USB_WIN_TARGET_MASK (0xF << MV_USB_WIN_TARGET_OFFSET) - -#define MV_USB_WIN_ATTR_OFFSET 8 -#define MV_USB_WIN_ATTR_MASK (0xFF << MV_USB_WIN_ATTR_OFFSET) - -#define MV_USB_WIN_SIZE_OFFSET 16 -#define MV_USB_WIN_SIZE_MASK (0xFFFF << MV_USB_WIN_SIZE_OFFSET) - -#define MV_USB_WIN_BASE_OFFSET 16 -#define MV_USB_WIN_BASE_MASK (0xFFFF << MV_USB_WIN_BASE_OFFSET) - - -#define MV_USB_BRIDGE_IPG_REG(dev) (USB_REG_BASE(dev) + 0x360) - - -MV_STATUS mvUsbInit(int dev, MV_BOOL isHost); - -MV_STATUS mvUsbWinInit(int dev); -MV_STATUS mvUsbWinSet(int dev, MV_U32 winNum, MV_DEC_WIN *pAddrWin); -MV_STATUS mvUsbWinGet(int dev, MV_U32 winNum, MV_DEC_WIN *pAddrWin); - -void mvUsbAddrDecShow(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __INCmvUsbh */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysXor.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysXor.c deleted file mode 100644 index f9d0ab37d4..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysXor.c +++ /dev/null @@ -1,662 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include "xor/mvXor.h" -#include "mvSysXor.h" - -/* defines */ -#ifdef MV_DEBUG - #define DB(x) x -#else - #define DB(x) -#endif - - -static MV_STATUS xorWinOverlapDetect(MV_U32 unit,MV_U32 winNum, MV_ADDR_WIN *pAddrWin); - -MV_TARGET xorAddrDecPrioTap[] = -{ -#if defined(MV_INCLUDE_DEVICE_CS0) - DEVICE_CS0, -#endif -#if defined(MV_INCLUDE_PEX) - PEX0_MEM, -#endif -#if defined(MV_INCLUDE_SDRAM_CS0) - SDRAM_CS0, -#endif -#if defined(MV_INCLUDE_SDRAM_CS1) - SDRAM_CS1, -#endif -#if defined(MV_INCLUDE_SDRAM_CS2) - SDRAM_CS2, -#endif -#if defined(MV_INCLUDE_SDRAM_CS3) - SDRAM_CS3, -#endif -#if defined(MV_INCLUDE_DEVICE_CS1) - DEVICE_CS1, -#endif -#if defined(MV_INCLUDE_CESA) - CRYPT_ENG, -#endif - TBL_TERM -}; -static MV_STATUS mvXorInitWinsUnit (MV_U32 unit) -{ - MV_U32 winNum; - MV_XOR_DEC_WIN addrDecWin; - MV_CPU_DEC_WIN cpuAddrDecWin; - MV_U32 status; - MV_U32 winPrioIndex=0; - - /* Initiate XOR address decode */ - - /* First disable all address decode windows */ - for(winNum = 0; winNum < XOR_MAX_ADDR_DEC_WIN; winNum++) - { - mvXorTargetWinEnable(unit,winNum, MV_FALSE); - } - - /* Go through all windows in user table until table terminator */ - for (winNum = 0; ((xorAddrDecPrioTap[winPrioIndex] != TBL_TERM) && - (winNum < XOR_MAX_ADDR_DEC_WIN));) - { - /* first get attributes from CPU If */ - status = mvCpuIfTargetWinGet(xorAddrDecPrioTap[winPrioIndex], - &cpuAddrDecWin); - - if(MV_NO_SUCH == status) - { - winPrioIndex++; - continue; - } - if (MV_OK != status) - { - mvOsPrintf("%s: ERR. mvCpuIfTargetWinGet failed\n", __FUNCTION__); - return MV_ERROR; - } - - - if (cpuAddrDecWin.enable == MV_TRUE) - { - - addrDecWin.target = xorAddrDecPrioTap[winPrioIndex]; - addrDecWin.addrWin.baseLow = cpuAddrDecWin.addrWin.baseLow; - addrDecWin.addrWin.baseHigh = cpuAddrDecWin.addrWin.baseHigh; - addrDecWin.addrWin.size = cpuAddrDecWin.addrWin.size; - addrDecWin.enable = MV_TRUE; - - if (MV_OK != mvXorTargetWinSet(unit,winNum, &addrDecWin)) - { - DB(mvOsPrintf("mvXorInit: ERR. mvDmaTargetWinSet failed\n")); - return MV_ERROR; - } - winNum++; - } - winPrioIndex++; - - } - - return MV_OK; -} - - -/******************************************************************************* -* mvXorInit - Initialize XOR engine -* -* DESCRIPTION: -* This function initialize XOR unit. It set the default address decode -* windows of the unit. -* Note that if the address window is disabled in xorAddrDecMap, the -* window parameters will be set but the window will remain disabled. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. -*******************************************************************************/ -MV_STATUS mvXorInit (MV_VOID) -{ - MV_U32 i; - - /* Initiate XOR address decode */ - for(i = 0; i < MV_XOR_MAX_UNIT; i++) - mvXorInitWinsUnit(i); - - mvXorHalInit(MV_XOR_MAX_CHAN); - - return MV_OK; -} - -/******************************************************************************* -* mvXorTargetWinSet - Set XOR target address window -* -* DESCRIPTION: -* This function sets a peripheral target (e.g. SDRAM bank0, PCI_MEM0) -* address window. After setting this target window, the XOR will be -* able to access the target within the address window. -* -* INPUT: -* winNum - One of the possible XOR memory decode windows. -* target - Peripheral target enumerator. -* base - Window base address. -* size - Window size. -* enable - Window enable/disable. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. -* -*******************************************************************************/ -MV_STATUS mvXorTargetWinSet(MV_U32 unit, MV_U32 winNum, MV_XOR_DEC_WIN *pAddrDecWin) -{ - MV_DEC_REGS xorDecRegs; - MV_TARGET_ATTRIB targetAttribs; - MV_U32 chan; - - /* Parameter checking */ - if (winNum >= XOR_MAX_ADDR_DEC_WIN) - { - DB(mvOsPrintf("%s: ERR. Invalid win num %d\n",__FUNCTION__, winNum)); - return MV_BAD_PARAM; - } - if (pAddrDecWin == NULL) - { - DB(mvOsPrintf("%s: ERR. pAddrDecWin is NULL pointer\n", __FUNCTION__ )); - return MV_BAD_PTR; - } - /* Check if the requested window overlaps with current windows */ - if (MV_TRUE == xorWinOverlapDetect(unit, winNum, &pAddrDecWin->addrWin)) - { - DB(mvOsPrintf("%s: ERR. Window %d overlap\n",__FUNCTION__,winNum)); - return MV_ERROR; - } - - xorDecRegs.baseReg = MV_REG_READ(XOR_BASE_ADDR_REG(unit,winNum)); - xorDecRegs.sizeReg = MV_REG_READ(XOR_SIZE_MASK_REG(unit,winNum)); - - /* Get Base Address and size registers values */ - if(MV_OK != mvCtrlAddrDecToReg(&pAddrDecWin->addrWin, &xorDecRegs)) - { - DB(mvOsPrintf("%s: ERR. Invalid addr dec window\n",__FUNCTION__)); - return MV_BAD_PARAM; - } - - - mvCtrlAttribGet(pAddrDecWin->target,&targetAttribs); - - /* set attributes */ - xorDecRegs.baseReg &= ~XEBARX_ATTR_MASK; - xorDecRegs.baseReg |= targetAttribs.attrib << XEBARX_ATTR_OFFS; - /* set target ID */ - xorDecRegs.baseReg &= ~XEBARX_TARGET_MASK; - xorDecRegs.baseReg |= targetAttribs.targetId << XEBARX_TARGET_OFFS; - - - /* Write to address decode Base Address Register */ - MV_REG_WRITE(XOR_BASE_ADDR_REG(unit,winNum), xorDecRegs.baseReg); - - /* Write to Size Register */ - MV_REG_WRITE(XOR_SIZE_MASK_REG(unit,winNum), xorDecRegs.sizeReg); - - for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++) - { - if (pAddrDecWin->enable) - { - MV_REG_BIT_SET(XOR_WINDOW_CTRL_REG(unit,chan), - XEXWCR_WIN_EN_MASK(winNum)); - } - else - { - MV_REG_BIT_RESET(XOR_WINDOW_CTRL_REG(unit,chan), - XEXWCR_WIN_EN_MASK(winNum)); - } - } - return MV_OK; -} - -/******************************************************************************* -* mvXorTargetWinGet - Get xor peripheral target address window. -* -* DESCRIPTION: -* Get xor peripheral target address window. -* -* INPUT: -* winNum - One of the possible XOR memory decode windows. -* -* OUTPUT: -* base - Window base address. -* size - Window size. -* enable - window enable/disable. -* -* RETURN: -* MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. -* -*******************************************************************************/ -MV_STATUS mvXorTargetWinGet(MV_U32 unit,MV_U32 winNum, MV_XOR_DEC_WIN *pAddrDecWin) -{ - MV_DEC_REGS xorDecRegs; - MV_TARGET_ATTRIB targetAttrib; - MV_U32 chan=0,chanWinEn; - - /* Parameter checking */ - if (winNum >= XOR_MAX_ADDR_DEC_WIN) - { - DB(mvOsPrintf("%s: ERR. Invalid win num %d\n",__FUNCTION__ , winNum)); - return MV_ERROR; - } - - if (NULL == pAddrDecWin) - { - DB(mvOsPrintf("%s: ERR. pAddrDecWin is NULL pointer\n", __FUNCTION__ )); - return MV_BAD_PTR; - } - - chanWinEn = MV_REG_READ(XOR_WINDOW_CTRL_REG(unit,0)) & XEXWCR_WIN_EN_MASK(winNum); - - for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++) /* we should scan here all channels per unit */ - { - /* Check if enable bit is equal for all channels */ - if ((MV_REG_READ(XOR_WINDOW_CTRL_REG(unit,chan)) & - XEXWCR_WIN_EN_MASK(winNum)) != chanWinEn) - { - mvOsPrintf("%s: ERR. Window enable field must be equal in " - "all channels(chan=%d)\n",__FUNCTION__, chan); - return MV_ERROR; - } - } - - - - xorDecRegs.baseReg = MV_REG_READ(XOR_BASE_ADDR_REG(unit,winNum)); - xorDecRegs.sizeReg = MV_REG_READ(XOR_SIZE_MASK_REG(unit,winNum)); - - if (MV_OK != mvCtrlRegToAddrDec(&xorDecRegs, &pAddrDecWin->addrWin)) - { - mvOsPrintf("%s: ERR. mvCtrlRegToAddrDec failed\n", __FUNCTION__); - return MV_ERROR; - } - - /* attrib and targetId */ - targetAttrib.attrib = - (xorDecRegs.baseReg & XEBARX_ATTR_MASK) >> XEBARX_ATTR_OFFS; - targetAttrib.targetId = - (xorDecRegs.baseReg & XEBARX_TARGET_MASK) >> XEBARX_TARGET_OFFS; - - - pAddrDecWin->target = mvCtrlTargetGet(&targetAttrib); - - if(chanWinEn) - { - pAddrDecWin->enable = MV_TRUE; - } - else pAddrDecWin->enable = MV_FALSE; - - return MV_OK; -} - -/******************************************************************************* -* mvXorTargetWinEnable - Enable/disable a Xor address decode window -* -* DESCRIPTION: -* This function enable/disable a XOR address decode window. -* if parameter 'enable' == MV_TRUE the routine will enable the -* window, thus enabling XOR accesses (before enabling the window it is -* tested for overlapping). Otherwise, the window will be disabled. -* -* INPUT: -* winNum - Decode window number. -* enable - Enable/disable parameter. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. -* -*******************************************************************************/ -MV_STATUS mvXorTargetWinEnable(MV_U32 unit,MV_U32 winNum, MV_BOOL enable) -{ - MV_XOR_DEC_WIN addrDecWin; - MV_U32 chan; - - /* Parameter checking */ - if (winNum >= XOR_MAX_ADDR_DEC_WIN) - { - DB(mvOsPrintf("%s: ERR. Invalid winNum%d\n", __FUNCTION__, winNum)); - return MV_ERROR; - } - - if (enable == MV_TRUE) - { - /* Get current window */ - if (MV_OK != mvXorTargetWinGet(unit,winNum, &addrDecWin)) - { - DB(mvOsPrintf("%s: ERR. targetWinGet fail\n", __FUNCTION__)); - return MV_ERROR; - } - - /* Check for overlapping */ - if (MV_TRUE == xorWinOverlapDetect(unit,winNum, &(addrDecWin.addrWin))) - { - /* Overlap detected */ - DB(mvOsPrintf("%s: ERR. Overlap detected\n", __FUNCTION__)); - return MV_ERROR; - } - - /* No Overlap. Enable address decode target window */ - for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++) - { - MV_REG_BIT_SET(XOR_WINDOW_CTRL_REG(unit,chan), - XEXWCR_WIN_EN_MASK(winNum)); - } - - } - else - { - /* Disable address decode target window */ - - for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++) - { - MV_REG_BIT_RESET(XOR_WINDOW_CTRL_REG(unit,chan), - XEXWCR_WIN_EN_MASK(winNum)); - } - - } - - return MV_OK; -} - -/******************************************************************************* -* mvXorSetProtWinSet - Configure access attributes of a XOR engine -* to one of the XOR memory windows. -* -* DESCRIPTION: -* Each engine can be configured with access attributes for each of the -* memory spaces. This function sets access attributes -* to a given window for the given engine -* -* INPUTS: -* chan - One of the possible engines. -* winNum - One of the possible XOR memory spaces. -* access - Protection access rights. -* write - Write rights. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. -* -*******************************************************************************/ -MV_STATUS mvXorProtWinSet (MV_U32 unit,MV_U32 chan, MV_U32 winNum, MV_BOOL access, - MV_BOOL write) -{ - MV_U32 temp; - - /* Parameter checking */ - if (chan >= MV_XOR_MAX_CHAN_PER_UNIT) - { - DB(mvOsPrintf("%s: ERR. Invalid chan num %d\n", __FUNCTION__ , chan)); - return MV_BAD_PARAM; - } - if (winNum >= XOR_MAX_ADDR_DEC_WIN) - { - DB(mvOsPrintf("%s: ERR. Invalid win num %d\n", __FUNCTION__, winNum)); - return MV_BAD_PARAM; - } - - temp = MV_REG_READ(XOR_WINDOW_CTRL_REG(unit,chan)) & - (~XEXWCR_WIN_ACC_MASK(winNum)); - - /* if access is disable */ - if (!access) - { - /* disable access */ - temp |= XEXWCR_WIN_ACC_NO_ACC(winNum); - } - /* if access is enable */ - else - { - /* if write is enable */ - if (write) - { - /* enable write */ - temp |= XEXWCR_WIN_ACC_RW(winNum); - } - /* if write is disable */ - else - { - /* disable write */ - temp |= XEXWCR_WIN_ACC_RO(winNum); - } - } - MV_REG_WRITE(XOR_WINDOW_CTRL_REG(unit,chan),temp); - return MV_OK; -} - -/******************************************************************************* -* mvXorPciRemap - Set XOR remap register for PCI address windows. -* -* DESCRIPTION: -* only Windows 0-3 can be remapped. -* -* INPUT: -* winNum - window number -* pAddrDecWin - pointer to address space window structure -* OUTPUT: -* None. -* -* RETURN: -* MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. -* -*******************************************************************************/ -MV_STATUS mvXorPciRemap(MV_U32 unit,MV_U32 winNum, MV_U32 addrHigh) -{ - /* Parameter checking */ - if (winNum >= XOR_MAX_REMAP_WIN) - { - DB(mvOsPrintf("%s: ERR. Invalid win num %d\n", __FUNCTION__, winNum)); - return MV_BAD_PARAM; - } - - MV_REG_WRITE(XOR_HIGH_ADDR_REMAP_REG(unit,winNum), addrHigh); - - return MV_OK; -} - -/******************************************************************************* -* xorWinOverlapDetect - Detect XOR address windows overlaping -* -* DESCRIPTION: -* An unpredicted behaviour is expected in case XOR address decode -* windows overlaps. -* This function detects XOR address decode windows overlaping of a -* specified window. The function does not check the window itself for -* overlaping. The function also skipps disabled address decode windows. -* -* INPUT: -* winNum - address decode window number. -* pAddrDecWin - An address decode window struct. -* -* OUTPUT: -* None. -* -* RETURN: -* MV_TRUE if the given address window overlap current address -* decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data -* from registers. -* -*******************************************************************************/ -static MV_STATUS xorWinOverlapDetect(MV_U32 unit,MV_U32 winNum, MV_ADDR_WIN *pAddrWin) -{ - MV_U32 baseAddrEnableReg; - MV_U32 winNumIndex,chan; - MV_XOR_DEC_WIN addrDecWin; - - if (pAddrWin == NULL) - { - DB(mvOsPrintf("%s: ERR. pAddrWin is NULL pointer\n", __FUNCTION__ )); - return MV_BAD_PTR; - } - - for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++) - { - /* Read base address enable register. Do not check disabled windows */ - baseAddrEnableReg = MV_REG_READ(XOR_WINDOW_CTRL_REG(unit,chan)); - - for (winNumIndex = 0; winNumIndex < XOR_MAX_ADDR_DEC_WIN; winNumIndex++) - { - /* Do not check window itself */ - if (winNumIndex == winNum) - { - continue; - } - - /* Do not check disabled windows */ - if ((baseAddrEnableReg & XEXWCR_WIN_EN_MASK(winNumIndex)) == 0) - { - continue; - } - - /* Get window parameters */ - if (MV_OK != mvXorTargetWinGet(unit,winNumIndex, &addrDecWin)) - { - DB(mvOsPrintf("%s: ERR. TargetWinGet failed\n", __FUNCTION__ )); - return MV_ERROR; - } - - if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin))) - { - return MV_TRUE; - } - } - } - - return MV_FALSE; -} - -static MV_VOID mvXorAddrDecShowUnit(MV_U32 unit) -{ - MV_XOR_DEC_WIN win; - int i; - - mvOsOutput( "\n" ); - mvOsOutput( "XOR %d:\n", unit ); - mvOsOutput( "----\n" ); - - for( i = 0; i < XOR_MAX_ADDR_DEC_WIN; i++ ) - { - memset( &win, 0, sizeof(MV_XOR_DEC_WIN) ); - - mvOsOutput( "win%d - ", i ); - - if( mvXorTargetWinGet(unit, i, &win ) == MV_OK ) - { - if( win.enable ) - { - mvOsOutput( "%s base %x, ", - mvCtrlTargetNameGet(win.target), win.addrWin.baseLow ); - - mvSizePrint( win.addrWin.size ); - - mvOsOutput( "\n" ); - } - else - mvOsOutput( "disable\n" ); - } - } -} - -/******************************************************************************* -* mvXorAddrDecShow - Print the XOR address decode map. -* -* DESCRIPTION: -* This function print the XOR address decode map. -* -* INPUT: -* None. -* -* OUTPUT: -* None. -* -* RETURN: -* None. -* -*******************************************************************************/ -MV_VOID mvXorAddrDecShow(MV_VOID) -{ - int i; - - for( i = 0; i < MV_XOR_MAX_UNIT; i++ ) - mvXorAddrDecShowUnit(i); - -} diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysXor.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysXor.h deleted file mode 100644 index 73b2d9e6a4..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/ctrlEnv/sys/mvSysXor.h +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCMVSysXorh -#define __INCMVSysXorh - - -#ifdef __cplusplus -extern "C" { -#endif - -#include "ctrlEnv/sys/mvCpuIf.h" - -#include "ctrlEnv/mvCtrlEnvLib.h" -#include "ctrlEnv/mvCtrlEnvAddrDec.h" - -#define XOR_MAX_ADDR_DEC_WIN 8 /* Maximum address decode windows */ -#define XOR_MAX_REMAP_WIN 4 /* Maximum address arbiter windows */ - -/* XOR Engine Address Decoding Register Map */ -#define XOR_WINDOW_CTRL_REG(unit,chan) (XOR_UNIT_BASE(unit)+(0x240 + ((chan) * 4))) -#define XOR_BASE_ADDR_REG(unit,winNum) (XOR_UNIT_BASE(unit)+(0x250 + ((winNum) * 4))) -#define XOR_SIZE_MASK_REG(unit,winNum) (XOR_UNIT_BASE(unit)+(0x270 + ((winNum) * 4))) -#define XOR_HIGH_ADDR_REMAP_REG(unit,winNum) (XOR_UNIT_BASE(unit)+(0x290 + ((winNum) * 4))) - -/* XOR Engine [0..1] Window Control Registers (XExWCR) */ -#define XEXWCR_WIN_EN_OFFS(winNum) (winNum) -#define XEXWCR_WIN_EN_MASK(winNum) (1 << (XEXWCR_WIN_EN_OFFS(winNum))) -#define XEXWCR_WIN_EN_ENABLE(winNum) (1 << (XEXWCR_WIN_EN_OFFS(winNum))) -#define XEXWCR_WIN_EN_DISABLE(winNum) (0 << (XEXWCR_WIN_EN_OFFS(winNum))) - -#define XEXWCR_WIN_ACC_OFFS(winNum) ((2 * winNum) + 16) -#define XEXWCR_WIN_ACC_MASK(winNum) (3 << (XEXWCR_WIN_ACC_OFFS(winNum))) -#define XEXWCR_WIN_ACC_NO_ACC(winNum) (0 << (XEXWCR_WIN_ACC_OFFS(winNum))) -#define XEXWCR_WIN_ACC_RO(winNum) (1 << (XEXWCR_WIN_ACC_OFFS(winNum))) -#define XEXWCR_WIN_ACC_RW(winNum) (3 << (XEXWCR_WIN_ACC_OFFS(winNum))) - -/* XOR Engine Base Address Registers (XEBARx) */ -#define XEBARX_TARGET_OFFS (0) -#define XEBARX_TARGET_MASK (0xF << XEBARX_TARGET_OFFS) -#define XEBARX_ATTR_OFFS (8) -#define XEBARX_ATTR_MASK (0xFF << XEBARX_ATTR_OFFS) -#define XEBARX_BASE_OFFS (16) -#define XEBARX_BASE_MASK (0xFFFF << XEBARX_BASE_OFFS) - -/* XOR Engine Size Mask Registers (XESMRx) */ -#define XESMRX_SIZE_MASK_OFFS (16) -#define XESMRX_SIZE_MASK_MASK (0xFFFF << XESMRX_SIZE_MASK_OFFS) - -/* XOR Engine High Address Remap Register (XEHARRx1) */ -#define XEHARRX_REMAP_OFFS (0) -#define XEHARRX_REMAP_MASK (0xFFFFFFFF << XEHARRX_REMAP_OFFS) - -typedef struct _mvXorDecWin -{ - MV_TARGET target; - MV_ADDR_WIN addrWin; /* An address window*/ - MV_BOOL enable; /* Address decode window is enabled/disabled */ - -}MV_XOR_DEC_WIN; - -MV_STATUS mvXorInit (MV_VOID); -MV_STATUS mvXorTargetWinSet(MV_U32 unit, MV_U32 winNum, - MV_XOR_DEC_WIN *pAddrDecWin); -MV_STATUS mvXorTargetWinGet(MV_U32 unit, MV_U32 winNum, - MV_XOR_DEC_WIN *pAddrDecWin); -MV_STATUS mvXorTargetWinEnable(MV_U32 unit, - MV_U32 winNum, MV_BOOL enable); -MV_STATUS mvXorProtWinSet (MV_U32 unit,MV_U32 chan, MV_U32 winNum, MV_BOOL access, - MV_BOOL write); -MV_STATUS mvXorPciRemap(MV_U32 unit, MV_U32 winNum, MV_U32 addrHigh); - -MV_VOID mvXorAddrDecShow(MV_VOID); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/device/mvDevice.c b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/device/mvDevice.c deleted file mode 100644 index 80325fc12d..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/device/mvDevice.c +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#include "device/mvDevice.h" - -/* defines */ -#ifdef MV_DEBUG - #define DB(x) x -#else - #define DB(x) -#endif - - - diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/device/mvDevice.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/device/mvDevice.h deleted file mode 100644 index 9350779668..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/device/mvDevice.h +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCmvDeviceH -#define __INCmvDeviceH - -#include "mvCommon.h" -#include "mvOs.h" -#include "ctrlEnv/mvCtrlEnvSpec.h" -#include "device/mvDeviceRegs.h" - - -#endif /* #ifndef __INCmvDeviceH */ diff --git a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/device/mvDeviceRegs.h b/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/device/mvDeviceRegs.h deleted file mode 100644 index 80778ad935..0000000000 --- a/target/linux/generic-2.4/files/crypto/ocf/kirkwood/mvHal/kw_family/device/mvDeviceRegs.h +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* -Copyright (C) Marvell International Ltd. and its affiliates - -This software file (the "File") is owned and distributed by Marvell -International Ltd. and/or its affiliates ("Marvell") under the following -alternative licensing terms. Once you have made an election to distribute the -File under one of the following license alternatives, please (i) delete this -introductory statement regarding license alternatives, (ii) delete the two -license alternatives that you have not elected to use and (iii) preserve the -Marvell copyright notice above. - -******************************************************************************** -Marvell Commercial License Option - -If you received this File from Marvell and you have entered into a commercial -license agreement (a "Commercial License") with Marvell, the File is licensed -to you under the terms of the applicable Commercial License. - -******************************************************************************** -Marvell GPL License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File in accordance with the terms and conditions of the General -Public License Version 2, June 1991 (the "GPL License"), a copy of which is -available along with the File in the license.txt file or by writing to the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or -on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - -THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED -WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY -DISCLAIMED. The GPL License provides additional details about this warranty -disclaimer. -******************************************************************************** -Marvell BSD License Option - -If you received this File from Marvell, you may opt to use, redistribute and/or -modify this File under the following licensing terms. -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Marvell nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*******************************************************************************/ - -#ifndef __INCmvDeviceRegsH -#define __INCmvDeviceRegsH - -#ifndef MV_ASMLANGUAGE -#include "ctrlEnv/mvCtrlEnvLib.h" -/* This enumerator describes the Marvell controller possible devices that */ -/* can be connected to its device interface. */ -typedef enum _mvDevice -{ -#if defined(MV_INCLUDE_DEVICE_CS0) - DEV_CS0 = 0, /* Device connected to dev CS[0] */ -#endif -#if defined(MV_INCLUDE_DEVICE_CS1) - DEV_CS1 = 1, /* Device connected to dev CS[1] */ -#endif -#if defined(MV_INCLUDE_DEVICE_CS2) - DEV_CS2 = 2, /* Device connected to dev CS[2] */ -#endif -#if defined(MV_INCLUDE_DEVICE_CS3) - DEV_CS3 = 3, /* Device connected to dev CS[2] */ -#endif -#if defined(MV_INCLUDE_DEVICE_CS4) - DEV_CS4 = 4, /* Device connected to BOOT dev */ -#endif - MV_DEV_MAX_CS = MV_DEVICE_MAX_CS -}MV_DEVICE; - - -#endif /* MV_ASMLANGUAGE */ - - -#define NAND_CTRL_REG 0x10470 - -#define NAND_ACTCEBOOT_BIT BIT1 - - -#endif /* #ifndef __INCmvDeviceRegsH */ |