18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 38c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the 48c2ecf20Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 58c2ecf20Sopenharmony_ci * option) any later version. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 88c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 98c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 108c2ecf20Sopenharmony_ci * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 118c2ecf20Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 128c2ecf20Sopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 138c2ecf20Sopenharmony_ci * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 148c2ecf20Sopenharmony_ci * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 158c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 168c2ecf20Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along 198c2ecf20Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 208c2ecf20Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * Copyright 2004 IDT Inc. (rischelp@idt.com) 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * Initial Release 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#ifndef _ASM_RC32434_PCI_H_ 288c2ecf20Sopenharmony_ci#define _ASM_RC32434_PCI_H_ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define epld_mask ((volatile unsigned char *)0xB900000d) 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define PCI0_BASE_ADDR 0x18080000 338c2ecf20Sopenharmony_ci#define PCI_LBA_COUNT 4 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistruct pci_map { 368c2ecf20Sopenharmony_ci u32 address; /* Address. */ 378c2ecf20Sopenharmony_ci u32 control; /* Control. */ 388c2ecf20Sopenharmony_ci u32 mapping; /* mapping. */ 398c2ecf20Sopenharmony_ci}; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistruct pci_reg { 428c2ecf20Sopenharmony_ci u32 pcic; 438c2ecf20Sopenharmony_ci u32 pcis; 448c2ecf20Sopenharmony_ci u32 pcism; 458c2ecf20Sopenharmony_ci u32 pcicfga; 468c2ecf20Sopenharmony_ci u32 pcicfgd; 478c2ecf20Sopenharmony_ci volatile struct pci_map pcilba[PCI_LBA_COUNT]; 488c2ecf20Sopenharmony_ci u32 pcidac; 498c2ecf20Sopenharmony_ci u32 pcidas; 508c2ecf20Sopenharmony_ci u32 pcidasm; 518c2ecf20Sopenharmony_ci u32 pcidad; 528c2ecf20Sopenharmony_ci u32 pcidma8c; 538c2ecf20Sopenharmony_ci u32 pcidma9c; 548c2ecf20Sopenharmony_ci u32 pcitc; 558c2ecf20Sopenharmony_ci}; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define PCI_MSU_COUNT 2 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cistruct pci_msu { 608c2ecf20Sopenharmony_ci u32 pciim[PCI_MSU_COUNT]; 618c2ecf20Sopenharmony_ci u32 pciom[PCI_MSU_COUNT]; 628c2ecf20Sopenharmony_ci u32 pciid; 638c2ecf20Sopenharmony_ci u32 pciiic; 648c2ecf20Sopenharmony_ci u32 pciiim; 658c2ecf20Sopenharmony_ci u32 pciiod; 668c2ecf20Sopenharmony_ci u32 pciioic; 678c2ecf20Sopenharmony_ci u32 pciioim; 688c2ecf20Sopenharmony_ci}; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci/* 718c2ecf20Sopenharmony_ci * PCI Control Register 728c2ecf20Sopenharmony_ci */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define PCI_CTL_EN (1 << 0) 758c2ecf20Sopenharmony_ci#define PCI_CTL_TNR (1 << 1) 768c2ecf20Sopenharmony_ci#define PCI_CTL_SCE (1 << 2) 778c2ecf20Sopenharmony_ci#define PCI_CTL_IEN (1 << 3) 788c2ecf20Sopenharmony_ci#define PCI_CTL_AAA (1 << 4) 798c2ecf20Sopenharmony_ci#define PCI_CTL_EAP (1 << 5) 808c2ecf20Sopenharmony_ci#define PCI_CTL_PCIM_BIT 6 818c2ecf20Sopenharmony_ci#define PCI_CTL_PCIM 0x000001c0 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#define PCI_CTL_PCIM_DIS 0 848c2ecf20Sopenharmony_ci#define PCI_CTL_PCIM_TNR 1 /* Satellite - target not ready */ 858c2ecf20Sopenharmony_ci#define PCI_CTL_PCIM_SUS 2 /* Satellite - suspended CPU. */ 868c2ecf20Sopenharmony_ci#define PCI_CTL_PCIM_EXT 3 /* Host - external arbiter. */ 878c2ecf20Sopenharmony_ci#define PCI_CTL PCIM_PRIO 4 /* Host - fixed priority arb. */ 888c2ecf20Sopenharmony_ci#define PCI_CTL_PCIM_RR 5 /* Host - round robin priority. */ 898c2ecf20Sopenharmony_ci#define PCI_CTL_PCIM_RSVD6 6 908c2ecf20Sopenharmony_ci#define PCI_CTL_PCIM_RSVD7 7 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define PCI_CTL_IGM (1 << 9) 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* 958c2ecf20Sopenharmony_ci * PCI Status Register 968c2ecf20Sopenharmony_ci */ 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci#define PCI_STAT_EED (1 << 0) 998c2ecf20Sopenharmony_ci#define PCI_STAT_WR (1 << 1) 1008c2ecf20Sopenharmony_ci#define PCI_STAT_NMI (1 << 2) 1018c2ecf20Sopenharmony_ci#define PCI_STAT_II (1 << 3) 1028c2ecf20Sopenharmony_ci#define PCI_STAT_CWE (1 << 4) 1038c2ecf20Sopenharmony_ci#define PCI_STAT_CRE (1 << 5) 1048c2ecf20Sopenharmony_ci#define PCI_STAT_MDPE (1 << 6) 1058c2ecf20Sopenharmony_ci#define PCI_STAT_STA (1 << 7) 1068c2ecf20Sopenharmony_ci#define PCI_STAT_RTA (1 << 8) 1078c2ecf20Sopenharmony_ci#define PCI_STAT_RMA (1 << 9) 1088c2ecf20Sopenharmony_ci#define PCI_STAT_SSE (1 << 10) 1098c2ecf20Sopenharmony_ci#define PCI_STAT_OSE (1 << 11) 1108c2ecf20Sopenharmony_ci#define PCI_STAT_PE (1 << 12) 1118c2ecf20Sopenharmony_ci#define PCI_STAT_TAE (1 << 13) 1128c2ecf20Sopenharmony_ci#define PCI_STAT_RLE (1 << 14) 1138c2ecf20Sopenharmony_ci#define PCI_STAT_BME (1 << 15) 1148c2ecf20Sopenharmony_ci#define PCI_STAT_PRD (1 << 16) 1158c2ecf20Sopenharmony_ci#define PCI_STAT_RIP (1 << 17) 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci/* 1188c2ecf20Sopenharmony_ci * PCI Status Mask Register 1198c2ecf20Sopenharmony_ci */ 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define PCI_STATM_EED PCI_STAT_EED 1228c2ecf20Sopenharmony_ci#define PCI_STATM_WR PCI_STAT_WR 1238c2ecf20Sopenharmony_ci#define PCI_STATM_NMI PCI_STAT_NMI 1248c2ecf20Sopenharmony_ci#define PCI_STATM_II PCI_STAT_II 1258c2ecf20Sopenharmony_ci#define PCI_STATM_CWE PCI_STAT_CWE 1268c2ecf20Sopenharmony_ci#define PCI_STATM_CRE PCI_STAT_CRE 1278c2ecf20Sopenharmony_ci#define PCI_STATM_MDPE PCI_STAT_MDPE 1288c2ecf20Sopenharmony_ci#define PCI_STATM_STA PCI_STAT_STA 1298c2ecf20Sopenharmony_ci#define PCI_STATM_RTA PCI_STAT_RTA 1308c2ecf20Sopenharmony_ci#define PCI_STATM_RMA PCI_STAT_RMA 1318c2ecf20Sopenharmony_ci#define PCI_STATM_SSE PCI_STAT_SSE 1328c2ecf20Sopenharmony_ci#define PCI_STATM_OSE PCI_STAT_OSE 1338c2ecf20Sopenharmony_ci#define PCI_STATM_PE PCI_STAT_PE 1348c2ecf20Sopenharmony_ci#define PCI_STATM_TAE PCI_STAT_TAE 1358c2ecf20Sopenharmony_ci#define PCI_STATM_RLE PCI_STAT_RLE 1368c2ecf20Sopenharmony_ci#define PCI_STATM_BME PCI_STAT_BME 1378c2ecf20Sopenharmony_ci#define PCI_STATM_PRD PCI_STAT_PRD 1388c2ecf20Sopenharmony_ci#define PCI_STATM_RIP PCI_STAT_RIP 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci/* 1418c2ecf20Sopenharmony_ci * PCI Configuration Address Register 1428c2ecf20Sopenharmony_ci */ 1438c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_BIT 2 1448c2ecf20Sopenharmony_ci#define PCI_CFGA_REG 0x000000fc 1458c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_ID (0x00 >> 2) /* use PCFGID */ 1468c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_04 (0x04 >> 2) /* use PCFG04_ */ 1478c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_08 (0x08 >> 2) /* use PCFG08_ */ 1488c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_0C (0x0C >> 2) /* use PCFG0C_ */ 1498c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA0 (0x10 >> 2) /* use PCIPBA_ */ 1508c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA1 (0x14 >> 2) /* use PCIPBA_ */ 1518c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA2 (0x18 >> 2) /* use PCIPBA_ */ 1528c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA3 (0x1c >> 2) /* use PCIPBA_ */ 1538c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_SUBSYS (0x2c >> 2) /* use PCFGSS_ */ 1548c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_3C (0x3C >> 2) /* use PCFG3C_ */ 1558c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBBA0C (0x44 >> 2) /* use PCIPBAC_ */ 1568c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA0M (0x48 >> 2) 1578c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA1C (0x4c >> 2) /* use PCIPBAC_ */ 1588c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA1M (0x50 >> 2) 1598c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA2C (0x54 >> 2) /* use PCIPBAC_ */ 1608c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA2M (0x58 >> 2) 1618c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA3C (0x5c >> 2) /* use PCIPBAC_ */ 1628c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PBA3M (0x60 >> 2) 1638c2ecf20Sopenharmony_ci#define PCI_CFGA_REG_PMGT (0x64 >> 2) 1648c2ecf20Sopenharmony_ci#define PCI_CFGA_FUNC_BIT 8 1658c2ecf20Sopenharmony_ci#define PCI_CFGA_FUNC 0x00000700 1668c2ecf20Sopenharmony_ci#define PCI_CFGA_DEV_BIT 11 1678c2ecf20Sopenharmony_ci#define PCI_CFGA_DEV 0x0000f800 1688c2ecf20Sopenharmony_ci#define PCI_CFGA_DEV_INTERN 0 1698c2ecf20Sopenharmony_ci#define PCI_CFGA_BUS_BIT 16 1708c2ecf20Sopenharmony_ci#define PCI CFGA_BUS 0x00ff0000 1718c2ecf20Sopenharmony_ci#define PCI_CFGA_BUS_TYPE0 0 1728c2ecf20Sopenharmony_ci#define PCI_CFGA_EN (1 << 31) 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci/* PCI CFG04 commands */ 1758c2ecf20Sopenharmony_ci#define PCI_CFG04_CMD_IO_ENA (1 << 0) 1768c2ecf20Sopenharmony_ci#define PCI_CFG04_CMD_MEM_ENA (1 << 1) 1778c2ecf20Sopenharmony_ci#define PCI_CFG04_CMD_BM_ENA (1 << 2) 1788c2ecf20Sopenharmony_ci#define PCI_CFG04_CMD_MW_INV (1 << 4) 1798c2ecf20Sopenharmony_ci#define PCI_CFG04_CMD_PAR_ENA (1 << 6) 1808c2ecf20Sopenharmony_ci#define PCI_CFG04_CMD_SER_ENA (1 << 8) 1818c2ecf20Sopenharmony_ci#define PCI_CFG04_CMD_FAST_ENA (1 << 9) 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci/* PCI CFG04 status fields */ 1848c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_BIT 16 1858c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT 0xffff0000 1868c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_66_MHZ (1 << 21) 1878c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_FBB (1 << 23) 1888c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_MDPE (1 << 24) 1898c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_DST (1 << 25) 1908c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_STA (1 << 27) 1918c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_RTA (1 << 28) 1928c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_RMA (1 << 29) 1938c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_SSE (1 << 30) 1948c2ecf20Sopenharmony_ci#define PCI_CFG04_STAT_PE (1 << 31) 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci#define PCI_PBA_MSI (1 << 0) 1978c2ecf20Sopenharmony_ci#define PCI_PBA_P (1 << 2) 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci/* PCI PBAC registers */ 2008c2ecf20Sopenharmony_ci#define PCI_PBAC_MSI (1 << 0) 2018c2ecf20Sopenharmony_ci#define PCI_PBAC_P (1 << 1) 2028c2ecf20Sopenharmony_ci#define PCI_PBAC_SIZE_BIT 2 2038c2ecf20Sopenharmony_ci#define PCI_PBAC_SIZE 0x0000007c 2048c2ecf20Sopenharmony_ci#define PCI_PBAC_SB (1 << 7) 2058c2ecf20Sopenharmony_ci#define PCI_PBAC_PP (1 << 8) 2068c2ecf20Sopenharmony_ci#define PCI_PBAC_MR_BIT 9 2078c2ecf20Sopenharmony_ci#define PCI_PBAC_MR 0x00000600 2088c2ecf20Sopenharmony_ci#define PCI_PBAC_MR_RD 0 2098c2ecf20Sopenharmony_ci#define PCI_PBAC_MR_RD_LINE 1 2108c2ecf20Sopenharmony_ci#define PCI_PBAC_MR_RD_MULT 2 2118c2ecf20Sopenharmony_ci#define PCI_PBAC_MRL (1 << 11) 2128c2ecf20Sopenharmony_ci#define PCI_PBAC_MRM (1 << 12) 2138c2ecf20Sopenharmony_ci#define PCI_PBAC_TRP (1 << 13) 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci#define PCI_CFG40_TRDY_TIM 0x000000ff 2168c2ecf20Sopenharmony_ci#define PCI_CFG40_RET_LIM 0x0000ff00 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci/* 2198c2ecf20Sopenharmony_ci * PCI Local Base Address [0|1|2|3] Register 2208c2ecf20Sopenharmony_ci */ 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci#define PCI_LBA_BADDR_BIT 0 2238c2ecf20Sopenharmony_ci#define PCI_LBA_BADDR 0xffffff00 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci/* 2268c2ecf20Sopenharmony_ci * PCI Local Base Address Control Register 2278c2ecf20Sopenharmony_ci */ 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci#define PCI_LBAC_MSI (1 << 0) 2308c2ecf20Sopenharmony_ci#define PCI_LBAC_MSI_MEM 0 2318c2ecf20Sopenharmony_ci#define PCI_LBAC_MSI_IO 1 2328c2ecf20Sopenharmony_ci#define PCI_LBAC_SIZE_BIT 2 2338c2ecf20Sopenharmony_ci#define PCI_LBAC_SIZE 0x0000007c 2348c2ecf20Sopenharmony_ci#define PCI_LBAC_SB (1 << 7) 2358c2ecf20Sopenharmony_ci#define PCI_LBAC_RT (1 << 8) 2368c2ecf20Sopenharmony_ci#define PCI_LBAC_RT_NO_PREF 0 2378c2ecf20Sopenharmony_ci#define PCI_LBAC_RT_PREF 1 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci/* 2408c2ecf20Sopenharmony_ci * PCI Local Base Address [0|1|2|3] Mapping Register 2418c2ecf20Sopenharmony_ci */ 2428c2ecf20Sopenharmony_ci#define PCI_LBAM_MADDR_BIT 8 2438c2ecf20Sopenharmony_ci#define PCI_LBAM_MADDR 0xffffff00 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci/* 2468c2ecf20Sopenharmony_ci * PCI Decoupled Access Control Register 2478c2ecf20Sopenharmony_ci */ 2488c2ecf20Sopenharmony_ci#define PCI_DAC_DEN (1 << 0) 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci/* 2518c2ecf20Sopenharmony_ci * PCI Decoupled Access Status Register 2528c2ecf20Sopenharmony_ci */ 2538c2ecf20Sopenharmony_ci#define PCI_DAS_D (1 << 0) 2548c2ecf20Sopenharmony_ci#define PCI_DAS_B (1 << 1) 2558c2ecf20Sopenharmony_ci#define PCI_DAS_E (1 << 2) 2568c2ecf20Sopenharmony_ci#define PCI_DAS_OFE (1 << 3) 2578c2ecf20Sopenharmony_ci#define PCI_DAS_OFF (1 << 4) 2588c2ecf20Sopenharmony_ci#define PCI_DAS_IFE (1 << 5) 2598c2ecf20Sopenharmony_ci#define PCI_DAS_IFF (1 << 6) 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci/* 2628c2ecf20Sopenharmony_ci * PCI DMA Channel 8 Configuration Register 2638c2ecf20Sopenharmony_ci */ 2648c2ecf20Sopenharmony_ci#define PCI_DMA8C_MBS_BIT 0 2658c2ecf20Sopenharmony_ci#define PCI_DMA8C_MBS 0x00000fff /* Maximum Burst Size. */ 2668c2ecf20Sopenharmony_ci#define PCI_DMA8C_OUR (1 << 12) 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci/* 2698c2ecf20Sopenharmony_ci * PCI DMA Channel 9 Configuration Register 2708c2ecf20Sopenharmony_ci */ 2718c2ecf20Sopenharmony_ci#define PCI_DMA9C_MBS_BIT 0 /* Maximum Burst Size. */ 2728c2ecf20Sopenharmony_ci#define PCI_DMA9C_MBS 0x00000fff 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci/* 2758c2ecf20Sopenharmony_ci * PCI to Memory(DMA Channel 8) AND Memory to PCI DMA(DMA Channel 9)Descriptors 2768c2ecf20Sopenharmony_ci */ 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci#define PCI_DMAD_PT_BIT 22 /* in DEVCMD field (descriptor) */ 2798c2ecf20Sopenharmony_ci#define PCI_DMAD_PT 0x00c00000 /* preferred transaction field */ 2808c2ecf20Sopenharmony_ci/* These are for reads (DMA channel 8) */ 2818c2ecf20Sopenharmony_ci#define PCI_DMAD_DEVCMD_MR 0 /* memory read */ 2828c2ecf20Sopenharmony_ci#define PCI_DMAD_DEVCMD_MRL 1 /* memory read line */ 2838c2ecf20Sopenharmony_ci#define PCI_DMAD_DEVCMD_MRM 2 /* memory read multiple */ 2848c2ecf20Sopenharmony_ci#define PCI_DMAD_DEVCMD_IOR 3 /* I/O read */ 2858c2ecf20Sopenharmony_ci/* These are for writes (DMA channel 9) */ 2868c2ecf20Sopenharmony_ci#define PCI_DMAD_DEVCMD_MW 0 /* memory write */ 2878c2ecf20Sopenharmony_ci#define PCI_DMAD_DEVCMD_MWI 1 /* memory write invalidate */ 2888c2ecf20Sopenharmony_ci#define PCI_DMAD_DEVCMD_IOW 3 /* I/O write */ 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci/* Swap byte field applies to both DMA channel 8 and 9 */ 2918c2ecf20Sopenharmony_ci#define PCI_DMAD_SB (1 << 24) /* swap byte field */ 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci/* 2958c2ecf20Sopenharmony_ci * PCI Target Control Register 2968c2ecf20Sopenharmony_ci */ 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci#define PCI_TC_RTIMER_BIT 0 2998c2ecf20Sopenharmony_ci#define PCI_TC_RTIMER 0x000000ff 3008c2ecf20Sopenharmony_ci#define PCI_TC_DTIMER_BIT 8 3018c2ecf20Sopenharmony_ci#define PCI_TC_DTIMER 0x0000ff00 3028c2ecf20Sopenharmony_ci#define PCI_TC_RDR (1 << 18) 3038c2ecf20Sopenharmony_ci#define PCI_TC_DDT (1 << 19) 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci/* 3068c2ecf20Sopenharmony_ci * PCI messaging unit [applies to both inbound and outbound registers ] 3078c2ecf20Sopenharmony_ci */ 3088c2ecf20Sopenharmony_ci#define PCI_MSU_M0 (1 << 0) 3098c2ecf20Sopenharmony_ci#define PCI_MSU_M1 (1 << 1) 3108c2ecf20Sopenharmony_ci#define PCI_MSU_DB (1 << 2) 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci#define PCI_MSG_ADDR 0xB8088010 3138c2ecf20Sopenharmony_ci#define PCI0_ADDR 0xB8080000 3148c2ecf20Sopenharmony_ci#define rc32434_pci ((struct pci_reg *) PCI0_ADDR) 3158c2ecf20Sopenharmony_ci#define rc32434_pci_msg ((struct pci_msu *) PCI_MSG_ADDR) 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci#define PCIM_SHFT 0x6 3188c2ecf20Sopenharmony_ci#define PCIM_BIT_LEN 0x7 3198c2ecf20Sopenharmony_ci#define PCIM_H_EA 0x3 3208c2ecf20Sopenharmony_ci#define PCIM_H_IA_FIX 0x4 3218c2ecf20Sopenharmony_ci#define PCIM_H_IA_RR 0x5 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci#define PCI_ADDR_START 0x50000000 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci#define CPUTOPCI_MEM_WIN 0x02000000 3268c2ecf20Sopenharmony_ci#define CPUTOPCI_IO_WIN 0x00100000 3278c2ecf20Sopenharmony_ci#define PCILBA_SIZE_SHFT 2 3288c2ecf20Sopenharmony_ci#define PCILBA_SIZE_MASK 0x1F 3298c2ecf20Sopenharmony_ci#define SIZE_256MB 0x1C 3308c2ecf20Sopenharmony_ci#define SIZE_128MB 0x1B 3318c2ecf20Sopenharmony_ci#define SIZE_64MB 0x1A 3328c2ecf20Sopenharmony_ci#define SIZE_32MB 0x19 3338c2ecf20Sopenharmony_ci#define SIZE_16MB 0x18 3348c2ecf20Sopenharmony_ci#define SIZE_4MB 0x16 3358c2ecf20Sopenharmony_ci#define SIZE_2MB 0x15 3368c2ecf20Sopenharmony_ci#define SIZE_1MB 0x14 3378c2ecf20Sopenharmony_ci#define KORINA_CONFIG0_ADDR 0x80000000 3388c2ecf20Sopenharmony_ci#define KORINA_CONFIG1_ADDR 0x80000004 3398c2ecf20Sopenharmony_ci#define KORINA_CONFIG2_ADDR 0x80000008 3408c2ecf20Sopenharmony_ci#define KORINA_CONFIG3_ADDR 0x8000000C 3418c2ecf20Sopenharmony_ci#define KORINA_CONFIG4_ADDR 0x80000010 3428c2ecf20Sopenharmony_ci#define KORINA_CONFIG5_ADDR 0x80000014 3438c2ecf20Sopenharmony_ci#define KORINA_CONFIG6_ADDR 0x80000018 3448c2ecf20Sopenharmony_ci#define KORINA_CONFIG7_ADDR 0x8000001C 3458c2ecf20Sopenharmony_ci#define KORINA_CONFIG8_ADDR 0x80000020 3468c2ecf20Sopenharmony_ci#define KORINA_CONFIG9_ADDR 0x80000024 3478c2ecf20Sopenharmony_ci#define KORINA_CONFIG10_ADDR 0x80000028 3488c2ecf20Sopenharmony_ci#define KORINA_CONFIG11_ADDR 0x8000002C 3498c2ecf20Sopenharmony_ci#define KORINA_CONFIG12_ADDR 0x80000030 3508c2ecf20Sopenharmony_ci#define KORINA_CONFIG13_ADDR 0x80000034 3518c2ecf20Sopenharmony_ci#define KORINA_CONFIG14_ADDR 0x80000038 3528c2ecf20Sopenharmony_ci#define KORINA_CONFIG15_ADDR 0x8000003C 3538c2ecf20Sopenharmony_ci#define KORINA_CONFIG16_ADDR 0x80000040 3548c2ecf20Sopenharmony_ci#define KORINA_CONFIG17_ADDR 0x80000044 3558c2ecf20Sopenharmony_ci#define KORINA_CONFIG18_ADDR 0x80000048 3568c2ecf20Sopenharmony_ci#define KORINA_CONFIG19_ADDR 0x8000004C 3578c2ecf20Sopenharmony_ci#define KORINA_CONFIG20_ADDR 0x80000050 3588c2ecf20Sopenharmony_ci#define KORINA_CONFIG21_ADDR 0x80000054 3598c2ecf20Sopenharmony_ci#define KORINA_CONFIG22_ADDR 0x80000058 3608c2ecf20Sopenharmony_ci#define KORINA_CONFIG23_ADDR 0x8000005C 3618c2ecf20Sopenharmony_ci#define KORINA_CONFIG24_ADDR 0x80000060 3628c2ecf20Sopenharmony_ci#define KORINA_CONFIG25_ADDR 0x80000064 3638c2ecf20Sopenharmony_ci#define KORINA_CMD (PCI_CFG04_CMD_IO_ENA | \ 3648c2ecf20Sopenharmony_ci PCI_CFG04_CMD_MEM_ENA | \ 3658c2ecf20Sopenharmony_ci PCI_CFG04_CMD_BM_ENA | \ 3668c2ecf20Sopenharmony_ci PCI_CFG04_CMD_MW_INV | \ 3678c2ecf20Sopenharmony_ci PCI_CFG04_CMD_PAR_ENA | \ 3688c2ecf20Sopenharmony_ci PCI_CFG04_CMD_SER_ENA) 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci#define KORINA_STAT (PCI_CFG04_STAT_MDPE | \ 3718c2ecf20Sopenharmony_ci PCI_CFG04_STAT_STA | \ 3728c2ecf20Sopenharmony_ci PCI_CFG04_STAT_RTA | \ 3738c2ecf20Sopenharmony_ci PCI_CFG04_STAT_RMA | \ 3748c2ecf20Sopenharmony_ci PCI_CFG04_STAT_SSE | \ 3758c2ecf20Sopenharmony_ci PCI_CFG04_STAT_PE) 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci#define KORINA_CNFG1 (KORINA_STAT | KORINA_CMD) 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci#define KORINA_REVID 0 3808c2ecf20Sopenharmony_ci#define KORINA_CLASS_CODE 0 3818c2ecf20Sopenharmony_ci#define KORINA_CNFG2 ((KORINA_CLASS_CODE<<8) | \ 3828c2ecf20Sopenharmony_ci KORINA_REVID) 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci#define KORINA_CACHE_LINE_SIZE 4 3858c2ecf20Sopenharmony_ci#define KORINA_MASTER_LAT 0x3c 3868c2ecf20Sopenharmony_ci#define KORINA_HEADER_TYPE 0 3878c2ecf20Sopenharmony_ci#define KORINA_BIST 0 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci#define KORINA_CNFG3 ((KORINA_BIST << 24) | \ 3908c2ecf20Sopenharmony_ci (KORINA_HEADER_TYPE<<16) | \ 3918c2ecf20Sopenharmony_ci (KORINA_MASTER_LAT<<8) | \ 3928c2ecf20Sopenharmony_ci KORINA_CACHE_LINE_SIZE) 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci#define KORINA_BAR0 0x00000008 /* 128 MB Memory */ 3958c2ecf20Sopenharmony_ci#define KORINA_BAR1 0x18800001 /* 1 MB IO */ 3968c2ecf20Sopenharmony_ci#define KORINA_BAR2 0x18000001 /* 2 MB IO window for Korina 3978c2ecf20Sopenharmony_ci internal Registers */ 3988c2ecf20Sopenharmony_ci#define KORINA_BAR3 0x48000008 /* Spare 128 MB Memory */ 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci#define KORINA_CNFG4 KORINA_BAR0 4018c2ecf20Sopenharmony_ci#define KORINA_CNFG5 KORINA_BAR1 4028c2ecf20Sopenharmony_ci#define KORINA_CNFG6 KORINA_BAR2 4038c2ecf20Sopenharmony_ci#define KORINA_CNFG7 KORINA_BAR3 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci#define KORINA_SUBSYS_VENDOR_ID 0x011d 4068c2ecf20Sopenharmony_ci#define KORINA_SUBSYSTEM_ID 0x0214 4078c2ecf20Sopenharmony_ci#define KORINA_CNFG8 0 4088c2ecf20Sopenharmony_ci#define KORINA_CNFG9 0 4098c2ecf20Sopenharmony_ci#define KORINA_CNFG10 0 4108c2ecf20Sopenharmony_ci#define KORINA_CNFG11 ((KORINA_SUBSYS_VENDOR_ID<<16) | \ 4118c2ecf20Sopenharmony_ci KORINA_SUBSYSTEM_ID) 4128c2ecf20Sopenharmony_ci#define KORINA_INT_LINE 1 4138c2ecf20Sopenharmony_ci#define KORINA_INT_PIN 1 4148c2ecf20Sopenharmony_ci#define KORINA_MIN_GNT 8 4158c2ecf20Sopenharmony_ci#define KORINA_MAX_LAT 0x38 4168c2ecf20Sopenharmony_ci#define KORINA_CNFG12 0 4178c2ecf20Sopenharmony_ci#define KORINA_CNFG13 0 4188c2ecf20Sopenharmony_ci#define KORINA_CNFG14 0 4198c2ecf20Sopenharmony_ci#define KORINA_CNFG15 ((KORINA_MAX_LAT<<24) | \ 4208c2ecf20Sopenharmony_ci (KORINA_MIN_GNT<<16) | \ 4218c2ecf20Sopenharmony_ci (KORINA_INT_PIN<<8) | \ 4228c2ecf20Sopenharmony_ci KORINA_INT_LINE) 4238c2ecf20Sopenharmony_ci#define KORINA_RETRY_LIMIT 0x80 4248c2ecf20Sopenharmony_ci#define KORINA_TRDY_LIMIT 0x80 4258c2ecf20Sopenharmony_ci#define KORINA_CNFG16 ((KORINA_RETRY_LIMIT<<8) | \ 4268c2ecf20Sopenharmony_ci KORINA_TRDY_LIMIT) 4278c2ecf20Sopenharmony_ci#define PCI_PBAxC_R 0x0 4288c2ecf20Sopenharmony_ci#define PCI_PBAxC_RL 0x1 4298c2ecf20Sopenharmony_ci#define PCI_PBAxC_RM 0x2 4308c2ecf20Sopenharmony_ci#define SIZE_SHFT 2 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci#if defined(__MIPSEB__) 4338c2ecf20Sopenharmony_ci#define KORINA_PBA0C (PCI_PBAC_MRL | PCI_PBAC_SB | \ 4348c2ecf20Sopenharmony_ci ((PCI_PBAxC_RM & 0x3) << PCI_PBAC_MR_BIT) | \ 4358c2ecf20Sopenharmony_ci PCI_PBAC_PP | \ 4368c2ecf20Sopenharmony_ci (SIZE_128MB<<SIZE_SHFT) | \ 4378c2ecf20Sopenharmony_ci PCI_PBAC_P) 4388c2ecf20Sopenharmony_ci#else 4398c2ecf20Sopenharmony_ci#define KORINA_PBA0C (PCI_PBAC_MRL | \ 4408c2ecf20Sopenharmony_ci ((PCI_PBAxC_RM & 0x3) << PCI_PBAC_MR_BIT) | \ 4418c2ecf20Sopenharmony_ci PCI_PBAC_PP | \ 4428c2ecf20Sopenharmony_ci (SIZE_128MB<<SIZE_SHFT) | \ 4438c2ecf20Sopenharmony_ci PCI_PBAC_P) 4448c2ecf20Sopenharmony_ci#endif 4458c2ecf20Sopenharmony_ci#define KORINA_CNFG17 KORINA_PBA0C 4468c2ecf20Sopenharmony_ci#define KORINA_PBA0M 0x0 4478c2ecf20Sopenharmony_ci#define KORINA_CNFG18 KORINA_PBA0M 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_ci#if defined(__MIPSEB__) 4508c2ecf20Sopenharmony_ci#define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | PCI_PBAC_SB | \ 4518c2ecf20Sopenharmony_ci PCI_PBAC_MSI) 4528c2ecf20Sopenharmony_ci#else 4538c2ecf20Sopenharmony_ci#define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | \ 4548c2ecf20Sopenharmony_ci PCI_PBAC_MSI) 4558c2ecf20Sopenharmony_ci#endif 4568c2ecf20Sopenharmony_ci#define KORINA_CNFG19 KORINA_PBA1C 4578c2ecf20Sopenharmony_ci#define KORINA_PBA1M 0x0 4588c2ecf20Sopenharmony_ci#define KORINA_CNFG20 KORINA_PBA1M 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_ci#if defined(__MIPSEB__) 4618c2ecf20Sopenharmony_ci#define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | PCI_PBAC_SB | \ 4628c2ecf20Sopenharmony_ci PCI_PBAC_MSI) 4638c2ecf20Sopenharmony_ci#else 4648c2ecf20Sopenharmony_ci#define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | \ 4658c2ecf20Sopenharmony_ci PCI_PBAC_MSI) 4668c2ecf20Sopenharmony_ci#endif 4678c2ecf20Sopenharmony_ci#define KORINA_CNFG21 KORINA_PBA2C 4688c2ecf20Sopenharmony_ci#define KORINA_PBA2M 0x18000000 4698c2ecf20Sopenharmony_ci#define KORINA_CNFG22 KORINA_PBA2M 4708c2ecf20Sopenharmony_ci#define KORINA_PBA3C 0 4718c2ecf20Sopenharmony_ci#define KORINA_CNFG23 KORINA_PBA3C 4728c2ecf20Sopenharmony_ci#define KORINA_PBA3M 0 4738c2ecf20Sopenharmony_ci#define KORINA_CNFG24 KORINA_PBA3M 4748c2ecf20Sopenharmony_ci 4758c2ecf20Sopenharmony_ci#define PCITC_DTIMER_VAL 8 4768c2ecf20Sopenharmony_ci#define PCITC_RTIMER_VAL 0x10 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci#endif /* __ASM_RC32434_PCI_H */ 479