amcc460ex.h revision 1.3 1 /* $NetBSD: amcc460ex.h,v 1.3 2026/06/19 18:55:24 rkujawa Exp $ */
2
3 /*
4 * Copyright (c) 2012, 2014, 2024, 2026 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Radoslaw Kujawa.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 /*
32 * AMCC/AppliedMicro 460EX system-on-chip
33 */
34
35 #ifndef _IBM4XX_AMCC460EX_H_
36 #define _IBM4XX_AMCC460EX_H_
37
38 /* Upper 4 bits (ERPN) of the physical address of the I/O region */
39 #define AMCC460EX_OPB_PA_HIGH 0x4
40
41 #define AMCC460EX_OPB_BASE 0xef600000
42
43 #define AMCC460EX_UART0_BASE 0xef600300
44 #define AMCC460EX_UART1_BASE 0xef600400
45 #define AMCC460EX_UART2_BASE 0xef600500
46 #define AMCC460EX_UART3_BASE 0xef600600
47 #define AMCC460EX_IIC0_BASE 0xef600700
48 #define AMCC460EX_IIC1_BASE 0xef600800
49 #define AMCC460EX_GPIO0_BASE 0xef600b00
50 #define AMCC460EX_ZMII0_BASE 0xef600d00
51 #define AMCC460EX_EMAC0_BASE 0xef600e00
52 #define AMCC460EX_EMAC1_BASE 0xef600f00
53 #define AMCC460EX_TAH0_BASE 0xef601350
54 #define AMCC460EX_TAH1_BASE 0xef601450
55 #define AMCC460EX_RGMII0_BASE 0xef601500
56
57 /* UARTs get freq from external 11.0592 MHz osc */
58 #define AMCC460EX_COM_FREQ 11059200
59
60 /*
61 * PLB-PCIX host bridge.
62 */
63 #define AMCC460EX_PCIX0_CFG_PLBA 0x0ec00000 /* ERPN 0xc */
64 #define AMCC460EX_PCIX0_REGS_PLBA 0x0ec80000 /* ERPN 0xc */
65 #define AMCC460EX_PCIX0_CFG_PA_HIGH 0xc
66 #define AMCC460EX_PCIX0_IO_PLBA 0x08000000 /* ERPN 0xc */
67 #define AMCC460EX_PCIX0_IO_PA_HIGH 0xc
68 #define AMCC460EX_PCIX0_MEM_BASE 0x80000000 /* ERPN 0xd */
69 #define AMCC460EX_PCIX0_MEM_PLBA_H 0xd
70 /* How much of the (128MB) outbound memory window has pinned mappings */
71 #define AMCC460EX_PCIX0_MEM_SIZE 0x05000000 /* 80MB */
72
73 /*
74 * Second outbound memory window (POM1)
75 */
76 #define AMCC460EX_PCIX0_PMEM_BASE 0x88000000 /* ERPN 0xd */
77 #define AMCC460EX_PCIX0_PMEM_PLBA_H 0xd
78 #define AMCC460EX_PCIX0_PMEM_SIZE 0x10000000 /* 256MB POM1/extent */
79 /* How much of the prefetchable window gets pinned into kernel VA */
80 #define AMCC460EX_PCIX0_PMEM_MAP 0x04000000 /* 64MB */
81
82 /*
83 * PCI Express root complexes (PCIE0/PCIE1).
84 */
85 #define AMCC460EX_PCIE0_DCR_BASE 0x100 /* PEGPL register block */
86 #define AMCC460EX_PCIE1_DCR_BASE 0x120
87
88 #define AMCC460EX_PCIE_CFG_PA_HIGH 0xd /* ERPN of config windows */
89 #define AMCC460EX_PCIE0_CFG_PLBA 0x30000000
90 #define AMCC460EX_PCIE1_CFG_PLBA 0x38000000
91 #define AMCC460EX_PCIE_CFG_SIZE 0x01000000 /* buses 0-15 */
92
93 #define AMCC460EX_PCIE_MEM_PA_HIGH 0xe /* ERPN of memory windows */
94 #define AMCC460EX_PCIE0_MEM_PLBA 0x10000000
95 #define AMCC460EX_PCIE1_MEM_PLBA 0x90000000
96 #define AMCC460EX_PCIE_MEM_BASE 0xa0000000 /* PCI-side base */
97 #define AMCC460EX_PCIE_MEM_SIZE 0x01000000
98
99 /* INTA-INTD, flat irq numbers (UIC3 bits 12-15 and 16-19) */
100 #define AMCC460EX_PCIE0_INTA_IRQ 108
101 #define AMCC460EX_PCIE1_INTA_IRQ 112
102
103 /*
104 * AHB peripherals (USB).
105 */
106 #define AMCC460EX_AHB_PA_HIGH 0x4 /* ERPN */
107 #define AMCC460EX_AHB_BASE 0xbf000000
108 #define AMCC460EX_AHB_SIZE 0x01000000
109
110 #define AMCC460EX_USB_OTG_BASE 0xbff80000 /* DWC OTG, 256KB */
111 #define AMCC460EX_USB_OTG_SIZE 0x00040000
112 #define AMCC460EX_USB_OHCI_BASE 0xbffd0000
113 #define AMCC460EX_USB_OHCI_SIZE 0x00000400
114 #define AMCC460EX_USB_EHCI_BASE 0xbffd0400
115 #define AMCC460EX_USB_EHCI_SIZE 0x00000400
116
117 /*
118 * On-chip SATA, the lousy DWC SATA-II core
119 */
120 #define AMCC460EX_SATA_DMA_BASE 0xbffd0800
121 #define AMCC460EX_SATA_DMA_SIZE 0x00000400
122 #define AMCC460EX_SATA_BASE 0xbffd1000
123 #define AMCC460EX_SATA_SIZE 0x00000800
124
125 /*
126 * Per-port PCIe SDR registers
127 */
128 #define AMCC460EX_PESDR0_LOOP 0x303
129 #define AMCC460EX_PESDR0_RCSSET 0x304
130 #define AMCC460EX_PESDR0_RCSSTS 0x305
131 #define AMCC460EX_PESDR1_LOOP 0x343
132 #define AMCC460EX_PESDR1_RCSSET 0x344
133 #define AMCC460EX_PESDR1_RCSSTS 0x345
134
135 #define AMCC460EX_PESDR_LOOP_LNKUP 0x00001000 /* link trained */
136
137 /*
138 * Interrupt numbers in the flat PIC space:
139 * UIC0 : irqs 0-31
140 * UIC1 : cascaded via UIC0 bit 30) is irqs 32-63
141 * UIC2 : (UIC0 bit 10) is irqs 64-95
142 * UIC3 : (UIC0 bit 16) is irqs 96-127
143 */
144 #define AMCC460EX_UART0_IRQ 33 /* UIC1 bit 1 */
145 #define AMCC460EX_UART1_IRQ 1 /* UIC0 bit 1 */
146 #define AMCC460EX_IIC0_IRQ 2 /* UIC0 bit 2 */
147 #define AMCC460EX_IIC1_IRQ 3 /* UIC0 bit 3 */
148 #define AMCC460EX_PCI_IRQ 32 /* UIC1 bit 0: PCI INTA */
149 #define AMCC460EX_MAL_TXEOB_IRQ 70 /* UIC2 bit 6 */
150 #define AMCC460EX_MAL_RXEOB_IRQ 71 /* UIC2 bit 7 */
151 #define AMCC460EX_EMAC0_IRQ 80 /* UIC2 bit 16 */
152 #define AMCC460EX_EMAC1_IRQ 81 /* UIC2 bit 17 */
153 #define AMCC460EX_USB_EHCI_IRQ 93 /* UIC2 bit 29 */
154 #define AMCC460EX_USB_OHCI_IRQ 94 /* UIC2 bit 30 */
155 #define AMCC460EX_SATA_IRQ 96 /* UIC3 bit 0 */
156 #define AMCC460EX_SATA_DMA_IRQ 101 /* UIC3 bit 5: AHB DMAC */
157
158 /*
159 * L2 cache controller (L2C0) device control registers.
160 */
161 #define DCR_L2C0_CFG 0x030 /* L2 cache configuration */
162 #define L2C_CFG_L2M 0x80000000 /* SRAM array used as L2 */
163 #define L2C_CFG_ICU 0x40000000 /* I-cache uses L2 */
164 #define L2C_CFG_DCU 0x20000000 /* D-cache uses L2 */
165 #define L2C_CFG_FRAN 0x00200000 /* fast read ack (best perf) */
166 #define L2C_CFG_SS_256KB 0x00000000 /* SRAM size 256KB (only) */
167 #define L2C_CFG_SNPCI 0x00000020 /* snoop cache-inhibit writes */
168 #define L2C_CFG_RDBW 0x00000008 /* read byte write (required) */
169 #define DCR_L2C0_CMD 0x031 /* L2 cache command */
170 #define L2C_CMD_INV 0x20000000 /* invalidate at L2C0_ADDR */
171 #define L2C_CMD_CCP 0x10000000 /* clear cache parity error */
172 #define L2C_CMD_CTE 0x08000000 /* clear tag error */
173 #define L2C_CMD_HCC 0x00800000 /* hardware clear whole cache */
174 #define DCR_L2C0_ADDR 0x032 /* L2 cache address */
175 #define DCR_L2C0_DATA 0x033 /* L2 cache data */
176 #define DCR_L2C0_SR 0x034 /* L2 cache status */
177 #define L2C_SR_CC 0x80000000 /* command complete */
178 #define DCR_L2C0_REVID 0x035 /* L2 cache revision id */
179 #define DCR_L2C0_SNP0 0x036 /* L2 snoop region 0 */
180 #define DCR_L2C0_SNP1 0x037 /* L2 snoop region 1 */
181 #define L2C_SNP_SSR_SHIFT 12 /* size field (bits 16:19) shift */
182 #define L2C_SNP_ESR 0x00000800 /* enable snoop region */
183
184 /* Internal SRAM0 bank config registers; zeroed to free the array for L2. */
185 #define DCR_SRAM0_SB0CR 0x020
186 #define DCR_SRAM0_SB1CR 0x021
187 #define DCR_SRAM0_SB2CR 0x022
188 #define DCR_SRAM0_SB3CR 0x023
189
190 /*
191 * AHB-to-PLB bridge CSRs
192 */
193 #define DCR_AHB_REV 0x0a0 /* revision id */
194 #define DCR_AHB_TOP 0x0a4 /* PLB2AHB top address */
195 #define DCR_AHB_BOT 0x0a5 /* PLB2AHB bottom address */
196 #define DCR_AHB_ATT 0x0a6 /* PLB2AHB attribute */
197 #define DCR_AHB_CR 0x0a7 /* AHB2PLB control (PUOA in [6:3]) */
198 #define AHB_CR_PUOA_MASK 0x00000078 /* PLB upper order address */
199 #define AHB_CR_PUOA_SHIFT 3
200
201 #endif /* _IBM4XX_AMCC460EX_H_ */
202