| 1 | |
| 2 | /******************************************************************************* |
| 3 | Copyright (C) Marvell International Ltd. and its affiliates |
| 4 | |
| 5 | This software file (the "File") is owned and distributed by Marvell |
| 6 | International Ltd. and/or its affiliates ("Marvell") under the following |
| 7 | alternative licensing terms. Once you have made an election to distribute the |
| 8 | File under one of the following license alternatives, please (i) delete this |
| 9 | introductory statement regarding license alternatives, (ii) delete the two |
| 10 | license alternatives that you have not elected to use and (iii) preserve the |
| 11 | Marvell copyright notice above. |
| 12 | |
| 13 | ******************************************************************************** |
| 14 | Marvell Commercial License Option |
| 15 | |
| 16 | If you received this File from Marvell and you have entered into a commercial |
| 17 | license agreement (a "Commercial License") with Marvell, the File is licensed |
| 18 | to you under the terms of the applicable Commercial License. |
| 19 | |
| 20 | ******************************************************************************** |
| 21 | Marvell GPL License Option |
| 22 | |
| 23 | If you received this File from Marvell, you may opt to use, redistribute and/or |
| 24 | modify this File in accordance with the terms and conditions of the General |
| 25 | Public License Version 2, June 1991 (the "GPL License"), a copy of which is |
| 26 | available along with the File in the license.txt file or by writing to the Free |
| 27 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or |
| 28 | on the worldwide web at http://www.gnu.org/licenses/gpl.txt. |
| 29 | |
| 30 | THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED |
| 31 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY |
| 32 | DISCLAIMED. The GPL License provides additional details about this warranty |
| 33 | disclaimer. |
| 34 | ******************************************************************************** |
| 35 | Marvell BSD License Option |
| 36 | |
| 37 | If you received this File from Marvell, you may opt to use, redistribute and/or |
| 38 | modify this File under the following licensing terms. |
| 39 | Redistribution and use in source and binary forms, with or without modification, |
| 40 | are permitted provided that the following conditions are met: |
| 41 | |
| 42 | * Redistributions of source code must retain the above copyright notice, |
| 43 | this list of conditions and the following disclaimer. |
| 44 | |
| 45 | * Redistributions in binary form must reproduce the above copyright |
| 46 | notice, this list of conditions and the following disclaimer in the |
| 47 | documentation and/or other materials provided with the distribution. |
| 48 | |
| 49 | * Neither the name of Marvell nor the names of its contributors may be |
| 50 | used to endorse or promote products derived from this software without |
| 51 | specific prior written permission. |
| 52 | |
| 53 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 54 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 55 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 56 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 57 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 58 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 59 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 60 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 61 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 62 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 63 | |
| 64 | *******************************************************************************/ |
| 65 | #ifndef __INCMVSysSdmmcAddrDech |
| 66 | #define __INCMVSysSdmmcAddrDech |
| 67 | |
| 68 | #include "mvCommon.h" |
| 69 | #include "ctrlEnv/mvCtrlEnvLib.h" |
| 70 | #include "ctrlEnv/sys/mvCpuIf.h" |
| 71 | |
| 72 | |
| 73 | #ifdef __cplusplus |
| 74 | extern "C" { |
| 75 | #endif |
| 76 | |
| 77 | typedef struct _mvSdmmcDecWin |
| 78 | { |
| 79 | MV_TARGET target; |
| 80 | MV_ADDR_WIN addrWin; /* An address window*/ |
| 81 | MV_BOOL enable; /* Address decode window is enabled/disabled */ |
| 82 | |
| 83 | } MV_SDMMC_DEC_WIN; |
| 84 | |
| 85 | |
| 86 | #define MV_SDMMC_MAX_ADDR_DECODE_WIN 4 |
| 87 | |
| 88 | #define MV_SDMMC_WIN_CTRL_REG(dev, win) (MV_SDIO_REG_BASE + 0x108 + ((win)<<3)) |
| 89 | #define MV_SDMMC_WIN_BASE_REG(dev, win) (MV_SDIO_REG_BASE + 0x10c + ((win)<<3)) |
| 90 | |
| 91 | |
| 92 | /* BITs in Windows 0-3 Control and Base Registers */ |
| 93 | #define MV_SDMMC_WIN_ENABLE_BIT 0 |
| 94 | #define MV_SDMMC_WIN_ENABLE_MASK (1<<MV_SDMMC_WIN_ENABLE_BIT) |
| 95 | |
| 96 | #define MV_SDMMC_WIN_TARGET_OFFSET 4 |
| 97 | #define MV_SDMMC_WIN_TARGET_MASK (0xF<<MV_SDMMC_WIN_TARGET_OFFSET) |
| 98 | |
| 99 | #define MV_SDMMC_WIN_ATTR_OFFSET 8 |
| 100 | #define MV_SDMMC_WIN_ATTR_MASK (0xFF<<MV_SDMMC_WIN_ATTR_OFFSET) |
| 101 | |
| 102 | #define MV_SDMMC_WIN_SIZE_OFFSET 16 |
| 103 | #define MV_SDMMC_WIN_SIZE_MASK (0xFFFF<<MV_SDMMC_WIN_SIZE_OFFSET) |
| 104 | |
| 105 | #define MV_SDMMC_WIN_BASE_OFFSET 16 |
| 106 | #define MV_SDMMC_WIN_BASE_MASK (0xFFFF<<MV_SDMMC_WIN_BASE_OFFSET) |
| 107 | |
| 108 | MV_STATUS mvSdmmcWinGet(int dev, MV_U32 winNum, MV_SDMMC_DEC_WIN *pAddrDecWin); |
| 109 | MV_STATUS mvSdmmcWinSet(int dev, MV_U32 winNum, MV_SDMMC_DEC_WIN *pAddrDecWin); |
| 110 | MV_STATUS mvSdmmcWinByTargetGet(MV_TARGET target, MV_SDMMC_DEC_WIN *pAddrDecWin); |
| 111 | MV_STATUS mvSdmmcWinInit(MV_VOID); |
| 112 | MV_VOID mvSdmmcAddrDecShow(MV_VOID); |
| 113 | |
| 114 | |
| 115 | #ifdef __cplusplus |
| 116 | } |
| 117 | #endif |
| 118 | |
| 119 | |
| 120 | #endif |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |