0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #ifndef _ASM_RC32434_PCI_H_
0028 #define _ASM_RC32434_PCI_H_
0029
0030 #define epld_mask ((volatile unsigned char *)0xB900000d)
0031
0032 #define PCI0_BASE_ADDR 0x18080000
0033 #define PCI_LBA_COUNT 4
0034
0035 struct pci_map {
0036 u32 address;
0037 u32 control;
0038 u32 mapping;
0039 };
0040
0041 struct pci_reg {
0042 u32 pcic;
0043 u32 pcis;
0044 u32 pcism;
0045 u32 pcicfga;
0046 u32 pcicfgd;
0047 volatile struct pci_map pcilba[PCI_LBA_COUNT];
0048 u32 pcidac;
0049 u32 pcidas;
0050 u32 pcidasm;
0051 u32 pcidad;
0052 u32 pcidma8c;
0053 u32 pcidma9c;
0054 u32 pcitc;
0055 };
0056
0057 #define PCI_MSU_COUNT 2
0058
0059 struct pci_msu {
0060 u32 pciim[PCI_MSU_COUNT];
0061 u32 pciom[PCI_MSU_COUNT];
0062 u32 pciid;
0063 u32 pciiic;
0064 u32 pciiim;
0065 u32 pciiod;
0066 u32 pciioic;
0067 u32 pciioim;
0068 };
0069
0070
0071
0072
0073
0074 #define PCI_CTL_EN (1 << 0)
0075 #define PCI_CTL_TNR (1 << 1)
0076 #define PCI_CTL_SCE (1 << 2)
0077 #define PCI_CTL_IEN (1 << 3)
0078 #define PCI_CTL_AAA (1 << 4)
0079 #define PCI_CTL_EAP (1 << 5)
0080 #define PCI_CTL_PCIM_BIT 6
0081 #define PCI_CTL_PCIM 0x000001c0
0082
0083 #define PCI_CTL_PCIM_DIS 0
0084 #define PCI_CTL_PCIM_TNR 1
0085 #define PCI_CTL_PCIM_SUS 2
0086 #define PCI_CTL_PCIM_EXT 3
0087 #define PCI_CTL PCIM_PRIO 4
0088 #define PCI_CTL_PCIM_RR 5
0089 #define PCI_CTL_PCIM_RSVD6 6
0090 #define PCI_CTL_PCIM_RSVD7 7
0091
0092 #define PCI_CTL_IGM (1 << 9)
0093
0094
0095
0096
0097
0098 #define PCI_STAT_EED (1 << 0)
0099 #define PCI_STAT_WR (1 << 1)
0100 #define PCI_STAT_NMI (1 << 2)
0101 #define PCI_STAT_II (1 << 3)
0102 #define PCI_STAT_CWE (1 << 4)
0103 #define PCI_STAT_CRE (1 << 5)
0104 #define PCI_STAT_MDPE (1 << 6)
0105 #define PCI_STAT_STA (1 << 7)
0106 #define PCI_STAT_RTA (1 << 8)
0107 #define PCI_STAT_RMA (1 << 9)
0108 #define PCI_STAT_SSE (1 << 10)
0109 #define PCI_STAT_OSE (1 << 11)
0110 #define PCI_STAT_PE (1 << 12)
0111 #define PCI_STAT_TAE (1 << 13)
0112 #define PCI_STAT_RLE (1 << 14)
0113 #define PCI_STAT_BME (1 << 15)
0114 #define PCI_STAT_PRD (1 << 16)
0115 #define PCI_STAT_RIP (1 << 17)
0116
0117
0118
0119
0120
0121 #define PCI_STATM_EED PCI_STAT_EED
0122 #define PCI_STATM_WR PCI_STAT_WR
0123 #define PCI_STATM_NMI PCI_STAT_NMI
0124 #define PCI_STATM_II PCI_STAT_II
0125 #define PCI_STATM_CWE PCI_STAT_CWE
0126 #define PCI_STATM_CRE PCI_STAT_CRE
0127 #define PCI_STATM_MDPE PCI_STAT_MDPE
0128 #define PCI_STATM_STA PCI_STAT_STA
0129 #define PCI_STATM_RTA PCI_STAT_RTA
0130 #define PCI_STATM_RMA PCI_STAT_RMA
0131 #define PCI_STATM_SSE PCI_STAT_SSE
0132 #define PCI_STATM_OSE PCI_STAT_OSE
0133 #define PCI_STATM_PE PCI_STAT_PE
0134 #define PCI_STATM_TAE PCI_STAT_TAE
0135 #define PCI_STATM_RLE PCI_STAT_RLE
0136 #define PCI_STATM_BME PCI_STAT_BME
0137 #define PCI_STATM_PRD PCI_STAT_PRD
0138 #define PCI_STATM_RIP PCI_STAT_RIP
0139
0140
0141
0142
0143 #define PCI_CFGA_REG_BIT 2
0144 #define PCI_CFGA_REG 0x000000fc
0145 #define PCI_CFGA_REG_ID (0x00 >> 2)
0146 #define PCI_CFGA_REG_04 (0x04 >> 2)
0147 #define PCI_CFGA_REG_08 (0x08 >> 2)
0148 #define PCI_CFGA_REG_0C (0x0C >> 2)
0149 #define PCI_CFGA_REG_PBA0 (0x10 >> 2)
0150 #define PCI_CFGA_REG_PBA1 (0x14 >> 2)
0151 #define PCI_CFGA_REG_PBA2 (0x18 >> 2)
0152 #define PCI_CFGA_REG_PBA3 (0x1c >> 2)
0153 #define PCI_CFGA_REG_SUBSYS (0x2c >> 2)
0154 #define PCI_CFGA_REG_3C (0x3C >> 2)
0155 #define PCI_CFGA_REG_PBBA0C (0x44 >> 2)
0156 #define PCI_CFGA_REG_PBA0M (0x48 >> 2)
0157 #define PCI_CFGA_REG_PBA1C (0x4c >> 2)
0158 #define PCI_CFGA_REG_PBA1M (0x50 >> 2)
0159 #define PCI_CFGA_REG_PBA2C (0x54 >> 2)
0160 #define PCI_CFGA_REG_PBA2M (0x58 >> 2)
0161 #define PCI_CFGA_REG_PBA3C (0x5c >> 2)
0162 #define PCI_CFGA_REG_PBA3M (0x60 >> 2)
0163 #define PCI_CFGA_REG_PMGT (0x64 >> 2)
0164 #define PCI_CFGA_FUNC_BIT 8
0165 #define PCI_CFGA_FUNC 0x00000700
0166 #define PCI_CFGA_DEV_BIT 11
0167 #define PCI_CFGA_DEV 0x0000f800
0168 #define PCI_CFGA_DEV_INTERN 0
0169 #define PCI_CFGA_BUS_BIT 16
0170 #define PCI CFGA_BUS 0x00ff0000
0171 #define PCI_CFGA_BUS_TYPE0 0
0172 #define PCI_CFGA_EN (1 << 31)
0173
0174
0175 #define PCI_CFG04_CMD_IO_ENA (1 << 0)
0176 #define PCI_CFG04_CMD_MEM_ENA (1 << 1)
0177 #define PCI_CFG04_CMD_BM_ENA (1 << 2)
0178 #define PCI_CFG04_CMD_MW_INV (1 << 4)
0179 #define PCI_CFG04_CMD_PAR_ENA (1 << 6)
0180 #define PCI_CFG04_CMD_SER_ENA (1 << 8)
0181 #define PCI_CFG04_CMD_FAST_ENA (1 << 9)
0182
0183
0184 #define PCI_CFG04_STAT_BIT 16
0185 #define PCI_CFG04_STAT 0xffff0000
0186 #define PCI_CFG04_STAT_66_MHZ (1 << 21)
0187 #define PCI_CFG04_STAT_FBB (1 << 23)
0188 #define PCI_CFG04_STAT_MDPE (1 << 24)
0189 #define PCI_CFG04_STAT_DST (1 << 25)
0190 #define PCI_CFG04_STAT_STA (1 << 27)
0191 #define PCI_CFG04_STAT_RTA (1 << 28)
0192 #define PCI_CFG04_STAT_RMA (1 << 29)
0193 #define PCI_CFG04_STAT_SSE (1 << 30)
0194 #define PCI_CFG04_STAT_PE (1 << 31)
0195
0196 #define PCI_PBA_MSI (1 << 0)
0197 #define PCI_PBA_P (1 << 2)
0198
0199
0200 #define PCI_PBAC_MSI (1 << 0)
0201 #define PCI_PBAC_P (1 << 1)
0202 #define PCI_PBAC_SIZE_BIT 2
0203 #define PCI_PBAC_SIZE 0x0000007c
0204 #define PCI_PBAC_SB (1 << 7)
0205 #define PCI_PBAC_PP (1 << 8)
0206 #define PCI_PBAC_MR_BIT 9
0207 #define PCI_PBAC_MR 0x00000600
0208 #define PCI_PBAC_MR_RD 0
0209 #define PCI_PBAC_MR_RD_LINE 1
0210 #define PCI_PBAC_MR_RD_MULT 2
0211 #define PCI_PBAC_MRL (1 << 11)
0212 #define PCI_PBAC_MRM (1 << 12)
0213 #define PCI_PBAC_TRP (1 << 13)
0214
0215 #define PCI_CFG40_TRDY_TIM 0x000000ff
0216 #define PCI_CFG40_RET_LIM 0x0000ff00
0217
0218
0219
0220
0221
0222 #define PCI_LBA_BADDR_BIT 0
0223 #define PCI_LBA_BADDR 0xffffff00
0224
0225
0226
0227
0228
0229 #define PCI_LBAC_MSI (1 << 0)
0230 #define PCI_LBAC_MSI_MEM 0
0231 #define PCI_LBAC_MSI_IO 1
0232 #define PCI_LBAC_SIZE_BIT 2
0233 #define PCI_LBAC_SIZE 0x0000007c
0234 #define PCI_LBAC_SB (1 << 7)
0235 #define PCI_LBAC_RT (1 << 8)
0236 #define PCI_LBAC_RT_NO_PREF 0
0237 #define PCI_LBAC_RT_PREF 1
0238
0239
0240
0241
0242 #define PCI_LBAM_MADDR_BIT 8
0243 #define PCI_LBAM_MADDR 0xffffff00
0244
0245
0246
0247
0248 #define PCI_DAC_DEN (1 << 0)
0249
0250
0251
0252
0253 #define PCI_DAS_D (1 << 0)
0254 #define PCI_DAS_B (1 << 1)
0255 #define PCI_DAS_E (1 << 2)
0256 #define PCI_DAS_OFE (1 << 3)
0257 #define PCI_DAS_OFF (1 << 4)
0258 #define PCI_DAS_IFE (1 << 5)
0259 #define PCI_DAS_IFF (1 << 6)
0260
0261
0262
0263
0264 #define PCI_DMA8C_MBS_BIT 0
0265 #define PCI_DMA8C_MBS 0x00000fff
0266 #define PCI_DMA8C_OUR (1 << 12)
0267
0268
0269
0270
0271 #define PCI_DMA9C_MBS_BIT 0
0272 #define PCI_DMA9C_MBS 0x00000fff
0273
0274
0275
0276
0277
0278 #define PCI_DMAD_PT_BIT 22
0279 #define PCI_DMAD_PT 0x00c00000
0280
0281 #define PCI_DMAD_DEVCMD_MR 0
0282 #define PCI_DMAD_DEVCMD_MRL 1
0283 #define PCI_DMAD_DEVCMD_MRM 2
0284 #define PCI_DMAD_DEVCMD_IOR 3
0285
0286 #define PCI_DMAD_DEVCMD_MW 0
0287 #define PCI_DMAD_DEVCMD_MWI 1
0288 #define PCI_DMAD_DEVCMD_IOW 3
0289
0290
0291 #define PCI_DMAD_SB (1 << 24)
0292
0293
0294
0295
0296
0297
0298 #define PCI_TC_RTIMER_BIT 0
0299 #define PCI_TC_RTIMER 0x000000ff
0300 #define PCI_TC_DTIMER_BIT 8
0301 #define PCI_TC_DTIMER 0x0000ff00
0302 #define PCI_TC_RDR (1 << 18)
0303 #define PCI_TC_DDT (1 << 19)
0304
0305
0306
0307
0308 #define PCI_MSU_M0 (1 << 0)
0309 #define PCI_MSU_M1 (1 << 1)
0310 #define PCI_MSU_DB (1 << 2)
0311
0312 #define PCI_MSG_ADDR 0xB8088010
0313 #define PCI0_ADDR 0xB8080000
0314 #define rc32434_pci ((struct pci_reg *) PCI0_ADDR)
0315 #define rc32434_pci_msg ((struct pci_msu *) PCI_MSG_ADDR)
0316
0317 #define PCIM_SHFT 0x6
0318 #define PCIM_BIT_LEN 0x7
0319 #define PCIM_H_EA 0x3
0320 #define PCIM_H_IA_FIX 0x4
0321 #define PCIM_H_IA_RR 0x5
0322
0323 #define PCI_ADDR_START 0x50000000
0324
0325 #define CPUTOPCI_MEM_WIN 0x02000000
0326 #define CPUTOPCI_IO_WIN 0x00100000
0327 #define PCILBA_SIZE_SHFT 2
0328 #define PCILBA_SIZE_MASK 0x1F
0329 #define SIZE_256MB 0x1C
0330 #define SIZE_128MB 0x1B
0331 #define SIZE_64MB 0x1A
0332 #define SIZE_32MB 0x19
0333 #define SIZE_16MB 0x18
0334 #define SIZE_4MB 0x16
0335 #define SIZE_2MB 0x15
0336 #define SIZE_1MB 0x14
0337 #define KORINA_CONFIG0_ADDR 0x80000000
0338 #define KORINA_CONFIG1_ADDR 0x80000004
0339 #define KORINA_CONFIG2_ADDR 0x80000008
0340 #define KORINA_CONFIG3_ADDR 0x8000000C
0341 #define KORINA_CONFIG4_ADDR 0x80000010
0342 #define KORINA_CONFIG5_ADDR 0x80000014
0343 #define KORINA_CONFIG6_ADDR 0x80000018
0344 #define KORINA_CONFIG7_ADDR 0x8000001C
0345 #define KORINA_CONFIG8_ADDR 0x80000020
0346 #define KORINA_CONFIG9_ADDR 0x80000024
0347 #define KORINA_CONFIG10_ADDR 0x80000028
0348 #define KORINA_CONFIG11_ADDR 0x8000002C
0349 #define KORINA_CONFIG12_ADDR 0x80000030
0350 #define KORINA_CONFIG13_ADDR 0x80000034
0351 #define KORINA_CONFIG14_ADDR 0x80000038
0352 #define KORINA_CONFIG15_ADDR 0x8000003C
0353 #define KORINA_CONFIG16_ADDR 0x80000040
0354 #define KORINA_CONFIG17_ADDR 0x80000044
0355 #define KORINA_CONFIG18_ADDR 0x80000048
0356 #define KORINA_CONFIG19_ADDR 0x8000004C
0357 #define KORINA_CONFIG20_ADDR 0x80000050
0358 #define KORINA_CONFIG21_ADDR 0x80000054
0359 #define KORINA_CONFIG22_ADDR 0x80000058
0360 #define KORINA_CONFIG23_ADDR 0x8000005C
0361 #define KORINA_CONFIG24_ADDR 0x80000060
0362 #define KORINA_CONFIG25_ADDR 0x80000064
0363 #define KORINA_CMD (PCI_CFG04_CMD_IO_ENA | \
0364 PCI_CFG04_CMD_MEM_ENA | \
0365 PCI_CFG04_CMD_BM_ENA | \
0366 PCI_CFG04_CMD_MW_INV | \
0367 PCI_CFG04_CMD_PAR_ENA | \
0368 PCI_CFG04_CMD_SER_ENA)
0369
0370 #define KORINA_STAT (PCI_CFG04_STAT_MDPE | \
0371 PCI_CFG04_STAT_STA | \
0372 PCI_CFG04_STAT_RTA | \
0373 PCI_CFG04_STAT_RMA | \
0374 PCI_CFG04_STAT_SSE | \
0375 PCI_CFG04_STAT_PE)
0376
0377 #define KORINA_CNFG1 ((KORINA_STAT<<16)|KORINA_CMD)
0378
0379 #define KORINA_REVID 0
0380 #define KORINA_CLASS_CODE 0
0381 #define KORINA_CNFG2 ((KORINA_CLASS_CODE<<8) | \
0382 KORINA_REVID)
0383
0384 #define KORINA_CACHE_LINE_SIZE 4
0385 #define KORINA_MASTER_LAT 0x3c
0386 #define KORINA_HEADER_TYPE 0
0387 #define KORINA_BIST 0
0388
0389 #define KORINA_CNFG3 ((KORINA_BIST << 24) | \
0390 (KORINA_HEADER_TYPE<<16) | \
0391 (KORINA_MASTER_LAT<<8) | \
0392 KORINA_CACHE_LINE_SIZE)
0393
0394 #define KORINA_BAR0 0x00000008
0395 #define KORINA_BAR1 0x18800001
0396 #define KORINA_BAR2 0x18000001
0397
0398 #define KORINA_BAR3 0x48000008
0399
0400 #define KORINA_CNFG4 KORINA_BAR0
0401 #define KORINA_CNFG5 KORINA_BAR1
0402 #define KORINA_CNFG6 KORINA_BAR2
0403 #define KORINA_CNFG7 KORINA_BAR3
0404
0405 #define KORINA_SUBSYS_VENDOR_ID 0x011d
0406 #define KORINA_SUBSYSTEM_ID 0x0214
0407 #define KORINA_CNFG8 0
0408 #define KORINA_CNFG9 0
0409 #define KORINA_CNFG10 0
0410 #define KORINA_CNFG11 ((KORINA_SUBSYS_VENDOR_ID<<16) | \
0411 KORINA_SUBSYSTEM_ID)
0412 #define KORINA_INT_LINE 1
0413 #define KORINA_INT_PIN 1
0414 #define KORINA_MIN_GNT 8
0415 #define KORINA_MAX_LAT 0x38
0416 #define KORINA_CNFG12 0
0417 #define KORINA_CNFG13 0
0418 #define KORINA_CNFG14 0
0419 #define KORINA_CNFG15 ((KORINA_MAX_LAT<<24) | \
0420 (KORINA_MIN_GNT<<16) | \
0421 (KORINA_INT_PIN<<8) | \
0422 KORINA_INT_LINE)
0423 #define KORINA_RETRY_LIMIT 0x80
0424 #define KORINA_TRDY_LIMIT 0x80
0425 #define KORINA_CNFG16 ((KORINA_RETRY_LIMIT<<8) | \
0426 KORINA_TRDY_LIMIT)
0427 #define PCI_PBAxC_R 0x0
0428 #define PCI_PBAxC_RL 0x1
0429 #define PCI_PBAxC_RM 0x2
0430 #define SIZE_SHFT 2
0431
0432 #if defined(__MIPSEB__)
0433 #define KORINA_PBA0C (PCI_PBAC_MRL | PCI_PBAC_SB | \
0434 ((PCI_PBAxC_RM & 0x3) << PCI_PBAC_MR_BIT) | \
0435 PCI_PBAC_PP | \
0436 (SIZE_128MB<<SIZE_SHFT) | \
0437 PCI_PBAC_P)
0438 #else
0439 #define KORINA_PBA0C (PCI_PBAC_MRL | \
0440 ((PCI_PBAxC_RM & 0x3) << PCI_PBAC_MR_BIT) | \
0441 PCI_PBAC_PP | \
0442 (SIZE_128MB<<SIZE_SHFT) | \
0443 PCI_PBAC_P)
0444 #endif
0445 #define KORINA_CNFG17 KORINA_PBA0C
0446 #define KORINA_PBA0M 0x0
0447 #define KORINA_CNFG18 KORINA_PBA0M
0448
0449 #if defined(__MIPSEB__)
0450 #define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | PCI_PBAC_SB | \
0451 PCI_PBAC_MSI)
0452 #else
0453 #define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | \
0454 PCI_PBAC_MSI)
0455 #endif
0456 #define KORINA_CNFG19 KORINA_PBA1C
0457 #define KORINA_PBA1M 0x0
0458 #define KORINA_CNFG20 KORINA_PBA1M
0459
0460 #if defined(__MIPSEB__)
0461 #define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | PCI_PBAC_SB | \
0462 PCI_PBAC_MSI)
0463 #else
0464 #define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | \
0465 PCI_PBAC_MSI)
0466 #endif
0467 #define KORINA_CNFG21 KORINA_PBA2C
0468 #define KORINA_PBA2M 0x18000000
0469 #define KORINA_CNFG22 KORINA_PBA2M
0470 #define KORINA_PBA3C 0
0471 #define KORINA_CNFG23 KORINA_PBA3C
0472 #define KORINA_PBA3M 0
0473 #define KORINA_CNFG24 KORINA_PBA3M
0474
0475 #define PCITC_DTIMER_VAL 8
0476 #define PCITC_RTIMER_VAL 0x10
0477
0478 #endif