1 1.1 jmcneill /* $NetBSD: omap2_gpmcreg.h,v 1.1 2019/11/01 11:53:35 jmcneill Exp $ */ 2 1.1 jmcneill /* 3 1.1 jmcneill * Copyright (c) 2007 Microsoft 4 1.1 jmcneill * All rights reserved. 5 1.1 jmcneill * 6 1.1 jmcneill * Redistribution and use in source and binary forms, with or without 7 1.1 jmcneill * modification, are permitted provided that the following conditions 8 1.1 jmcneill * are met: 9 1.1 jmcneill * 1. Redistributions of source code must retain the above copyright 10 1.1 jmcneill * notice, this list of conditions and the following disclaimer. 11 1.1 jmcneill * 2. Redistributions in binary form must reproduce the above copyright 12 1.1 jmcneill * notice, this list of conditions and the following disclaimer in the 13 1.1 jmcneill * documentation and/or other materials provided with the distribution. 14 1.1 jmcneill * 3. All advertising materials mentioning features or use of this software 15 1.1 jmcneill * must display the following acknowledgement: 16 1.1 jmcneill * This product includes software developed by Microsoft 17 1.1 jmcneill * 18 1.1 jmcneill * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 1.1 jmcneill * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 1.1 jmcneill * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 1.1 jmcneill * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTERS BE LIABLE FOR ANY DIRECT, 22 1.1 jmcneill * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 1.1 jmcneill * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 1.1 jmcneill * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 1.1 jmcneill * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 1.1 jmcneill * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 1.1 jmcneill * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 1.1 jmcneill * SUCH DAMAGE. 29 1.1 jmcneill */ 30 1.1 jmcneill 31 1.1 jmcneill #ifndef _OMAP2430GPMCREG_H 32 1.1 jmcneill #define _OMAP2430GPMCREG_H 33 1.1 jmcneill 34 1.1 jmcneill /* 35 1.1 jmcneill * Header for OMAP2 General Purpose Memory Controller 36 1.1 jmcneill */ 37 1.1 jmcneill 38 1.1 jmcneill #define GPMC_REVISION 0x000 39 1.1 jmcneill #define GPMC_SYSCONFIG 0x010 40 1.1 jmcneill #define GPMC_SYSSTATUS 0x014 41 1.1 jmcneill #define GPMC_IRQSTATUS 0x018 42 1.1 jmcneill #define GPMC_IRQENABLE 0x01C 43 1.1 jmcneill #define GPMC_TIMEOUT_CONTROL 0x040 44 1.1 jmcneill #define GPMC_ERR_ADDRESS 0x044 45 1.1 jmcneill #define GPMC_ERR_TYPE 0x048 46 1.1 jmcneill #define GPMC_CONFIG 0x050 47 1.1 jmcneill #define GPMC_STATUS 0x054 48 1.1 jmcneill #define GPMC_CONFIG1_0 0x060 49 1.1 jmcneill #define GPMC_CONFIG2_0 0x064 50 1.1 jmcneill #define GPMC_CONFIG3_0 0x068 51 1.1 jmcneill #define GPMC_CONFIG4_0 0x06C 52 1.1 jmcneill #define GPMC_CONFIG5_0 0x070 53 1.1 jmcneill #define GPMC_CONFIG6_0 0x074 54 1.1 jmcneill #define GPMC_CONFIG7_0 0x078 55 1.1 jmcneill #define GPMC_NAND_COMMAND_0 0x07C 56 1.1 jmcneill #define GPMC_NAND_ADDRESS_0 0x080 57 1.1 jmcneill #define GPMC_NAND_DATA_0 0x084 58 1.1 jmcneill #define GPMC_CONFIG1_1 0x090 59 1.1 jmcneill #define GPMC_CONFIG2_1 0x094 60 1.1 jmcneill #define GPMC_CONFIG3_1 0x098 61 1.1 jmcneill #define GPMC_CONFIG4_1 0x09C 62 1.1 jmcneill #define GPMC_CONFIG5_1 0x0A0 63 1.1 jmcneill #define GPMC_CONFIG6_1 0x0A4 64 1.1 jmcneill #define GPMC_CONFIG7_1 0x0A8 65 1.1 jmcneill #define GPMC_NAND_COMMAND_1 0x0AC 66 1.1 jmcneill #define GPMC_NAND_ADDRESS_1 0x0B0 67 1.1 jmcneill #define GPMC_NAND_DATA_1 0x0B4 68 1.1 jmcneill #define GPMC_CONFIG1_2 0x0C0 69 1.1 jmcneill #define GPMC_CONFIG2_2 0x0C4 70 1.1 jmcneill #define GPMC_CONFIG3_2 0x0C8 71 1.1 jmcneill #define GPMC_CONFIG4_2 0x0CC 72 1.1 jmcneill #define GPMC_CONFIG5_2 0x0D0 73 1.1 jmcneill #define GPMC_CONFIG6_2 0x0D4 74 1.1 jmcneill #define GPMC_CONFIG7_2 0x0D8 75 1.1 jmcneill #define GPMC_NAND_COMMAND_2 0x0DC 76 1.1 jmcneill #define GPMC_NAND_ADDRESS_2 0x0E0 77 1.1 jmcneill #define GPMC_NAND_DATA_2 0x0E4 78 1.1 jmcneill #define GPMC_CONFIG1_3 0x0F0 79 1.1 jmcneill #define GPMC_CONFIG2_3 0x0F4 80 1.1 jmcneill #define GPMC_CONFIG3_3 0x0F8 81 1.1 jmcneill #define GPMC_CONFIG4_3 0x0FC 82 1.1 jmcneill #define GPMC_CONFIG5_3 0x100 83 1.1 jmcneill #define GPMC_CONFIG6_3 0x104 84 1.1 jmcneill #define GPMC_CONFIG7_3 0x108 85 1.1 jmcneill #define GPMC_NAND_COMMAND_3 0x10C 86 1.1 jmcneill #define GPMC_NAND_ADDRESS_3 0x110 87 1.1 jmcneill #define GPMC_NAND_DATA_3 0x114 88 1.1 jmcneill #define GPMC_CONFIG1_4 0x120 89 1.1 jmcneill #define GPMC_CONFIG2_4 0x124 90 1.1 jmcneill #define GPMC_CONFIG3_4 0x128 91 1.1 jmcneill #define GPMC_CONFIG4_4 0x12C 92 1.1 jmcneill #define GPMC_CONFIG5_4 0x130 93 1.1 jmcneill #define GPMC_CONFIG6_4 0x134 94 1.1 jmcneill #define GPMC_CONFIG7_4 0x138 95 1.1 jmcneill #define GPMC_NAND_COMMAND_4 0x13C 96 1.1 jmcneill #define GPMC_NAND_ADDRESS_4 0x140 97 1.1 jmcneill #define GPMC_NAND_DATA_4 0x144 98 1.1 jmcneill #define GPMC_CONFIG1_5 0x150 99 1.1 jmcneill #define GPMC_CONFIG2_5 0x154 100 1.1 jmcneill #define GPMC_CONFIG3_5 0x158 101 1.1 jmcneill #define GPMC_CONFIG4_5 0x15C 102 1.1 jmcneill #define GPMC_CONFIG5_5 0x160 103 1.1 jmcneill #define GPMC_CONFIG6_5 0x164 104 1.1 jmcneill #define GPMC_CONFIG7_5 0x168 105 1.1 jmcneill #define GPMC_NAND_COMMAND_5 0x16C 106 1.1 jmcneill #define GPMC_NAND_ADDRESS_5 0x170 107 1.1 jmcneill #define GPMC_NAND_DATA_5 0x174 108 1.1 jmcneill #define GPMC_CONFIG1_6 0x180 109 1.1 jmcneill #define GPMC_CONFIG2_6 0x184 110 1.1 jmcneill #define GPMC_CONFIG3_6 0x188 111 1.1 jmcneill #define GPMC_CONFIG4_6 0x18C 112 1.1 jmcneill #define GPMC_CONFIG5_6 0x190 113 1.1 jmcneill #define GPMC_CONFIG6_6 0x194 114 1.1 jmcneill #define GPMC_CONFIG7_6 0x198 115 1.1 jmcneill #define GPMC_NAND_COMMAND_6 0x19C 116 1.1 jmcneill #define GPMC_NAND_ADDRESS_6 0x1A0 117 1.1 jmcneill #define GPMC_NAND_DATA_6 0x1A4 118 1.1 jmcneill #define GPMC_CONFIG1_7 0x1B0 119 1.1 jmcneill #define GPMC_CONFIG2_7 0x1B4 120 1.1 jmcneill #define GPMC_CONFIG3_7 0x1B8 121 1.1 jmcneill #define GPMC_CONFIG4_7 0x1BC 122 1.1 jmcneill #define GPMC_CONFIG5_7 0x1C0 123 1.1 jmcneill #define GPMC_CONFIG6_7 0x1C4 124 1.1 jmcneill #define GPMC_CONFIG7_7 0x1C8 125 1.1 jmcneill #define GPMC_NAND_COMMAND_7 0x1CC 126 1.1 jmcneill #define GPMC_NAND_ADDRESS_7 0x1D0 127 1.1 jmcneill #define GPMC_NAND_DATA_7 0x1D4 128 1.1 jmcneill #define GPMC_PREFETCH_CONFIG1 0x1E0 129 1.1 jmcneill #define GPMC_PREFETCH_CONFIG2 0x1E4 130 1.1 jmcneill #define GPMC_PREFETCH_CONTROL 0x1EC 131 1.1 jmcneill #define GPMC_CONFIG1_6 0x180 132 1.1 jmcneill #define GPMC_CONFIG2_6 0x184 133 1.1 jmcneill #define GPMC_CONFIG3_6 0x188 134 1.1 jmcneill #define GPMC_CONFIG4_6 0x18C 135 1.1 jmcneill #define GPMC_CONFIG5_6 0x190 136 1.1 jmcneill #define GPMC_CONFIG6_6 0x194 137 1.1 jmcneill #define GPMC_CONFIG7_6 0x198 138 1.1 jmcneill #define GPMC_NAND_COMMAND_6 0x19C 139 1.1 jmcneill #define GPMC_NAND_ADDRESS_6 0x1A0 140 1.1 jmcneill #define GPMC_NAND_DATA_6 0x1A4 141 1.1 jmcneill #define GPMC_CONFIG1_7 0x1B0 142 1.1 jmcneill #define GPMC_CONFIG2_7 0x1B4 143 1.1 jmcneill #define GPMC_CONFIG3_7 0x1B8 144 1.1 jmcneill #define GPMC_CONFIG4_7 0x1BC 145 1.1 jmcneill #define GPMC_CONFIG5_7 0x1C0 146 1.1 jmcneill #define GPMC_CONFIG6_7 0x1C4 147 1.1 jmcneill #define GPMC_CONFIG7_7 0x1C8 148 1.1 jmcneill #define GPMC_NAND_COMMAND_7 0x1CC 149 1.1 jmcneill #define GPMC_NAND_ADDRESS_7 0x1D0 150 1.1 jmcneill #define GPMC_NAND_DATA_7 0x1D4 151 1.1 jmcneill #define GPMC_PREFETCH_CONFIG1 0x1E0 152 1.1 jmcneill #define GPMC_PREFETCH_CONFIG2 0x1E4 153 1.1 jmcneill #define GPMC_PREFETCH_CONTROL 0x1EC 154 1.1 jmcneill #define GPMC_PREFETCH_STATUS 0x1F0 155 1.1 jmcneill #define GPMC_ECC_CONFIG 0x1F4 156 1.1 jmcneill #define GPMC_ECC_CONTROL 0x1F8 157 1.1 jmcneill #define GPMC_ECC_SIZE_CONFIG 0x1FC 158 1.1 jmcneill #define GPMC_ECC1_RESULT 0x200 159 1.1 jmcneill #define GPMC_ECC2_RESULT 0x204 160 1.1 jmcneill #define GPMC_ECC3_RESULT 0x208 161 1.1 jmcneill #define GPMC_ECC4_RESULT 0x20C 162 1.1 jmcneill #define GPMC_ECC5_RESULT 0x210 163 1.1 jmcneill #define GPMC_ECC6_RESULT 0x214 164 1.1 jmcneill #define GPMC_ECC7_RESULT 0x218 165 1.1 jmcneill #define GPMC_ECC8_RESULT 0x21C 166 1.1 jmcneill #define GPMC_ECC9_RESULT 0x220 167 1.1 jmcneill #define GPMC_TESTMODE_CTRL 0x230 168 1.1 jmcneill #define GPMC_PSA_LSB 0x234 169 1.1 jmcneill #define GPMC_PSA_MSB 0x238 170 1.1 jmcneill 171 1.1 jmcneill #define GPMC_SIZE (GPMC_PSA_MSB + 4) 172 1.1 jmcneill #define GPMC_NCS 8 /* # Chip Selects */ 173 1.1 jmcneill #define GPMC_CS_SIZE (GPMC_CONFIG1_1 - GPMC_CONFIG1_0) 174 1.1 jmcneill 175 1.1 jmcneill #define GPMC_CS_CONFIG_BASE(base, cs) \ 176 1.1 jmcneill ((base) + GPMC_CONFIG1_0 + (cs) * GPMC_CS_SIZE) 177 1.1 jmcneill #define GPMC_CS_CONFIG(cs) \ 178 1.1 jmcneill (GPMC_CONFIG1_0 + (cs) * GPMC_CS_SIZE) 179 1.1 jmcneill 180 1.1 jmcneill #define GPMC_CONFIG1_i (GPMC_CONFIG1_0 - GPMC_CONFIG1_0) 181 1.1 jmcneill #define GPMC_CONFIG2_i (GPMC_CONFIG2_0 - GPMC_CONFIG1_0) 182 1.1 jmcneill #define GPMC_CONFIG3_i (GPMC_CONFIG3_0 - GPMC_CONFIG1_0) 183 1.1 jmcneill #define GPMC_CONFIG4_i (GPMC_CONFIG4_0 - GPMC_CONFIG1_0) 184 1.1 jmcneill #define GPMC_CONFIG5_i (GPMC_CONFIG5_0 - GPMC_CONFIG1_0) 185 1.1 jmcneill #define GPMC_CONFIG6_i (GPMC_CONFIG6_0 - GPMC_CONFIG1_0) 186 1.1 jmcneill #define GPMC_CONFIG7_i (GPMC_CONFIG7_0 - GPMC_CONFIG1_0) 187 1.1 jmcneill 188 1.1 jmcneill /* 189 1.1 jmcneill * GPMC OMAP2430_GPMC_REVISION 190 1.1 jmcneill */ 191 1.1 jmcneill #define GPMC_REVISION_REV __BITS(7,0) 192 1.1 jmcneill #define GPMC_REVISION_REV_MAJ(r) (((r) >> 4) & 0xf) 193 1.1 jmcneill #define GPMC_REVISION_REV_MIN(r) (((r) >> 0) & 0xf) 194 1.1 jmcneill 195 1.1 jmcneill /* 196 1.1 jmcneill * GPMC CONFIG7_[0-7] bits 197 1.1 jmcneill */ 198 1.1 jmcneill #define GPMC_CONFIG7_BASEADDRESS __BITS(5,0) 199 1.1 jmcneill #define GPMC_CONFIG7_CSVALID __BIT(6) 200 1.1 jmcneill #define GPMC_CONFIG7_MASKADDRESS __BITS(11,8) 201 1.1 jmcneill #define GPMC_CONFIG7(m, b) (((m) << 8) | (((b) >> 24) & 0x3f)) 202 1.1 jmcneill #define GPMC_CONFIG7_MASK_256M 0x0 203 1.1 jmcneill #define GPMC_CONFIG7_MASK_128M 0x8 204 1.1 jmcneill #define GPMC_CONFIG7_MASK_64M 0xc 205 1.1 jmcneill #define GPMC_CONFIG7_MASK_32M 0xe 206 1.1 jmcneill #define GPMC_CONFIG7_MASK_16M 0xf 207 1.1 jmcneill 208 1.1 jmcneill static __inline ulong 209 1.1 jmcneill omap_gpmc_config7_addr(uint32_t r) 210 1.1 jmcneill { 211 1.1 jmcneill return ((r) & GPMC_CONFIG7_BASEADDRESS) << 24; 212 1.1 jmcneill } 213 1.1 jmcneill static __inline ulong 214 1.1 jmcneill omap_gpmc_config7_size(uint32_t r) 215 1.1 jmcneill { 216 1.1 jmcneill uint i; 217 1.1 jmcneill uint mask; 218 1.1 jmcneill const struct { 219 1.1 jmcneill uint mask; 220 1.1 jmcneill ulong size; 221 1.1 jmcneill } gpmc_config7_size_tab[5] = { 222 1.1 jmcneill { GPMC_CONFIG7_MASK_256M, (256 << 20) }, 223 1.1 jmcneill { GPMC_CONFIG7_MASK_128M, (128 << 20) }, 224 1.1 jmcneill { GPMC_CONFIG7_MASK_64M, ( 64 << 20) }, 225 1.1 jmcneill { GPMC_CONFIG7_MASK_32M, ( 32 << 20) }, 226 1.1 jmcneill { GPMC_CONFIG7_MASK_16M, ( 16 << 20) }, 227 1.1 jmcneill }; 228 1.1 jmcneill mask = ((r) & GPMC_CONFIG7_MASKADDRESS) >> 8; 229 1.1 jmcneill for (i=0; i < 5; i++) { 230 1.1 jmcneill if (gpmc_config7_size_tab[i].mask == mask) 231 1.1 jmcneill return gpmc_config7_size_tab[i].size; 232 1.1 jmcneill } 233 1.1 jmcneill return 0; 234 1.1 jmcneill } 235 1.1 jmcneill 236 1.1 jmcneill #endif /* _OMAP2430GPMCREG_H */ 237