aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/netlogic
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/include/asm/netlogic')
-rw-r--r--arch/mips/include/asm/netlogic/common.h24
-rw-r--r--arch/mips/include/asm/netlogic/mips-extns.h7
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/bridge.h69
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/iomap.h48
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/pcibus.h41
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/pic.h77
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/sys.h18
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/uart.h3
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/xlp.h38
-rw-r--r--arch/mips/include/asm/netlogic/xlr/xlr.h5
10 files changed, 222 insertions, 108 deletions
diff --git a/arch/mips/include/asm/netlogic/common.h b/arch/mips/include/asm/netlogic/common.h
index bb68c3398c80..c281f03eb312 100644
--- a/arch/mips/include/asm/netlogic/common.h
+++ b/arch/mips/include/asm/netlogic/common.h
@@ -84,7 +84,6 @@ nlm_set_nmi_handler(void *handler)
84 */ 84 */
85void nlm_init_boot_cpu(void); 85void nlm_init_boot_cpu(void);
86unsigned int nlm_get_cpu_frequency(void); 86unsigned int nlm_get_cpu_frequency(void);
87void nlm_node_init(int node);
88extern struct plat_smp_ops nlm_smp_ops; 87extern struct plat_smp_ops nlm_smp_ops;
89extern char nlm_reset_entry[], nlm_reset_entry_end[]; 88extern char nlm_reset_entry[], nlm_reset_entry_end[];
90 89
@@ -94,26 +93,16 @@ extern struct dma_map_ops nlm_swiotlb_dma_ops;
94extern unsigned int nlm_threads_per_core; 93extern unsigned int nlm_threads_per_core;
95extern cpumask_t nlm_cpumask; 94extern cpumask_t nlm_cpumask;
96 95
97struct nlm_soc_info {
98 unsigned long coremask; /* cores enabled on the soc */
99 unsigned long ebase;
100 uint64_t irqmask;
101 uint64_t sysbase; /* only for XLP */
102 uint64_t picbase;
103 spinlock_t piclock;
104};
105
106#define nlm_get_node(i) (&nlm_nodes[i])
107#ifdef CONFIG_CPU_XLR
108#define nlm_current_node() (&nlm_nodes[0])
109#else
110#define nlm_current_node() (&nlm_nodes[nlm_nodeid()])
111#endif
112
113struct irq_data; 96struct irq_data;
114uint64_t nlm_pci_irqmask(int node); 97uint64_t nlm_pci_irqmask(int node);
98void nlm_setup_pic_irq(int node, int picirq, int irq, int irt);
115void nlm_set_pic_extra_ack(int node, int irq, void (*xack)(struct irq_data *)); 99void nlm_set_pic_extra_ack(int node, int irq, void (*xack)(struct irq_data *));
116 100
101#ifdef CONFIG_PCI_MSI
102void nlm_dispatch_msi(int node, int lirq);
103void nlm_dispatch_msix(int node, int msixirq);
104#endif
105
117/* 106/*
118 * The NR_IRQs is divided between nodes, each of them has a separate irq space 107 * The NR_IRQs is divided between nodes, each of them has a separate irq space
119 */ 108 */
@@ -122,7 +111,6 @@ static inline int nlm_irq_to_xirq(int node, int irq)
122 return node * NR_IRQS / NLM_NR_NODES + irq; 111 return node * NR_IRQS / NLM_NR_NODES + irq;
123} 112}
124 113
125extern struct nlm_soc_info nlm_nodes[NLM_NR_NODES];
126extern int nlm_cpu_ready[]; 114extern int nlm_cpu_ready[];
127#endif 115#endif
128#endif /* _NETLOGIC_COMMON_H_ */ 116#endif /* _NETLOGIC_COMMON_H_ */
diff --git a/arch/mips/include/asm/netlogic/mips-extns.h b/arch/mips/include/asm/netlogic/mips-extns.h
index f299d31d7c1a..de9aada6f4c1 100644
--- a/arch/mips/include/asm/netlogic/mips-extns.h
+++ b/arch/mips/include/asm/netlogic/mips-extns.h
@@ -146,7 +146,12 @@ static inline int hard_smp_processor_id(void)
146 146
147static inline int nlm_nodeid(void) 147static inline int nlm_nodeid(void)
148{ 148{
149 return (__read_32bit_c0_register($15, 1) >> 5) & 0x3; 149 uint32_t prid = read_c0_prid();
150
151 if ((prid & 0xff00) == PRID_IMP_NETLOGIC_XLP9XX)
152 return (__read_32bit_c0_register($15, 1) >> 7) & 0x7;
153 else
154 return (__read_32bit_c0_register($15, 1) >> 5) & 0x3;
150} 155}
151 156
152static inline unsigned int nlm_core_id(void) 157static inline unsigned int nlm_core_id(void)
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/bridge.h b/arch/mips/include/asm/netlogic/xlp-hal/bridge.h
index 4e8eacb9588a..3067f983495d 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/bridge.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/bridge.h
@@ -69,44 +69,9 @@
69#define BRIDGE_FLASH_LIMIT3 0x13 69#define BRIDGE_FLASH_LIMIT3 0x13
70 70
71#define BRIDGE_DRAM_BAR(i) (0x14 + (i)) 71#define BRIDGE_DRAM_BAR(i) (0x14 + (i))
72#define BRIDGE_DRAM_BAR0 0x14
73#define BRIDGE_DRAM_BAR1 0x15
74#define BRIDGE_DRAM_BAR2 0x16
75#define BRIDGE_DRAM_BAR3 0x17
76#define BRIDGE_DRAM_BAR4 0x18
77#define BRIDGE_DRAM_BAR5 0x19
78#define BRIDGE_DRAM_BAR6 0x1a
79#define BRIDGE_DRAM_BAR7 0x1b
80
81#define BRIDGE_DRAM_LIMIT(i) (0x1c + (i)) 72#define BRIDGE_DRAM_LIMIT(i) (0x1c + (i))
82#define BRIDGE_DRAM_LIMIT0 0x1c
83#define BRIDGE_DRAM_LIMIT1 0x1d
84#define BRIDGE_DRAM_LIMIT2 0x1e
85#define BRIDGE_DRAM_LIMIT3 0x1f
86#define BRIDGE_DRAM_LIMIT4 0x20
87#define BRIDGE_DRAM_LIMIT5 0x21
88#define BRIDGE_DRAM_LIMIT6 0x22
89#define BRIDGE_DRAM_LIMIT7 0x23
90
91#define BRIDGE_DRAM_NODE_TRANSLN(i) (0x24 + (i)) 73#define BRIDGE_DRAM_NODE_TRANSLN(i) (0x24 + (i))
92#define BRIDGE_DRAM_NODE_TRANSLN0 0x24
93#define BRIDGE_DRAM_NODE_TRANSLN1 0x25
94#define BRIDGE_DRAM_NODE_TRANSLN2 0x26
95#define BRIDGE_DRAM_NODE_TRANSLN3 0x27
96#define BRIDGE_DRAM_NODE_TRANSLN4 0x28
97#define BRIDGE_DRAM_NODE_TRANSLN5 0x29
98#define BRIDGE_DRAM_NODE_TRANSLN6 0x2a
99#define BRIDGE_DRAM_NODE_TRANSLN7 0x2b
100
101#define BRIDGE_DRAM_CHNL_TRANSLN(i) (0x2c + (i)) 74#define BRIDGE_DRAM_CHNL_TRANSLN(i) (0x2c + (i))
102#define BRIDGE_DRAM_CHNL_TRANSLN0 0x2c
103#define BRIDGE_DRAM_CHNL_TRANSLN1 0x2d
104#define BRIDGE_DRAM_CHNL_TRANSLN2 0x2e
105#define BRIDGE_DRAM_CHNL_TRANSLN3 0x2f
106#define BRIDGE_DRAM_CHNL_TRANSLN4 0x30
107#define BRIDGE_DRAM_CHNL_TRANSLN5 0x31
108#define BRIDGE_DRAM_CHNL_TRANSLN6 0x32
109#define BRIDGE_DRAM_CHNL_TRANSLN7 0x33
110 75
111#define BRIDGE_PCIEMEM_BASE0 0x34 76#define BRIDGE_PCIEMEM_BASE0 0x34
112#define BRIDGE_PCIEMEM_BASE1 0x35 77#define BRIDGE_PCIEMEM_BASE1 0x35
@@ -178,12 +143,42 @@
178#define BRIDGE_GIO_WEIGHT 0x2cb 143#define BRIDGE_GIO_WEIGHT 0x2cb
179#define BRIDGE_FLASH_WEIGHT 0x2cc 144#define BRIDGE_FLASH_WEIGHT 0x2cc
180 145
146/* FIXME verify */
147#define BRIDGE_9XX_FLASH_BAR(i) (0x11 + (i))
148#define BRIDGE_9XX_FLASH_BAR_LIMIT(i) (0x15 + (i))
149
150#define BRIDGE_9XX_DRAM_BAR(i) (0x19 + (i))
151#define BRIDGE_9XX_DRAM_LIMIT(i) (0x29 + (i))
152#define BRIDGE_9XX_DRAM_NODE_TRANSLN(i) (0x39 + (i))
153#define BRIDGE_9XX_DRAM_CHNL_TRANSLN(i) (0x49 + (i))
154
155#define BRIDGE_9XX_ADDRESS_ERROR0 0x9d
156#define BRIDGE_9XX_ADDRESS_ERROR1 0x9e
157#define BRIDGE_9XX_ADDRESS_ERROR2 0x9f
158
159#define BRIDGE_9XX_PCIEMEM_BASE0 0x59
160#define BRIDGE_9XX_PCIEMEM_BASE1 0x5a
161#define BRIDGE_9XX_PCIEMEM_BASE2 0x5b
162#define BRIDGE_9XX_PCIEMEM_BASE3 0x5c
163#define BRIDGE_9XX_PCIEMEM_LIMIT0 0x5d
164#define BRIDGE_9XX_PCIEMEM_LIMIT1 0x5e
165#define BRIDGE_9XX_PCIEMEM_LIMIT2 0x5f
166#define BRIDGE_9XX_PCIEMEM_LIMIT3 0x60
167#define BRIDGE_9XX_PCIEIO_BASE0 0x61
168#define BRIDGE_9XX_PCIEIO_BASE1 0x62
169#define BRIDGE_9XX_PCIEIO_BASE2 0x63
170#define BRIDGE_9XX_PCIEIO_BASE3 0x64
171#define BRIDGE_9XX_PCIEIO_LIMIT0 0x65
172#define BRIDGE_9XX_PCIEIO_LIMIT1 0x66
173#define BRIDGE_9XX_PCIEIO_LIMIT2 0x67
174#define BRIDGE_9XX_PCIEIO_LIMIT3 0x68
175
181#ifndef __ASSEMBLY__ 176#ifndef __ASSEMBLY__
182 177
183#define nlm_read_bridge_reg(b, r) nlm_read_reg(b, r) 178#define nlm_read_bridge_reg(b, r) nlm_read_reg(b, r)
184#define nlm_write_bridge_reg(b, r, v) nlm_write_reg(b, r, v) 179#define nlm_write_bridge_reg(b, r, v) nlm_write_reg(b, r, v)
185#define nlm_get_bridge_pcibase(node) \ 180#define nlm_get_bridge_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
186 nlm_pcicfg_base(XLP_IO_BRIDGE_OFFSET(node)) 181 XLP9XX_IO_BRIDGE_OFFSET(node) : XLP_IO_BRIDGE_OFFSET(node))
187#define nlm_get_bridge_regbase(node) \ 182#define nlm_get_bridge_regbase(node) \
188 (nlm_get_bridge_pcibase(node) + XLP_IO_PCI_HDRSZ) 183 (nlm_get_bridge_pcibase(node) + XLP_IO_PCI_HDRSZ)
189 184
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
index 55eee77adaca..1f23dfaa7167 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h
@@ -48,8 +48,10 @@
48#define XLP_IO_SIZE (64 << 20) /* ECFG space size */ 48#define XLP_IO_SIZE (64 << 20) /* ECFG space size */
49#define XLP_IO_PCI_HDRSZ 0x100 49#define XLP_IO_PCI_HDRSZ 0x100
50#define XLP_IO_DEV(node, dev) ((dev) + (node) * 8) 50#define XLP_IO_DEV(node, dev) ((dev) + (node) * 8)
51#define XLP_HDR_OFFSET(node, bus, dev, fn) (((bus) << 20) | \ 51#define XLP_IO_PCI_OFFSET(b, d, f) (((b) << 20) | ((d) << 15) | ((f) << 12))
52 ((XLP_IO_DEV(node, dev)) << 15) | ((fn) << 12)) 52
53#define XLP_HDR_OFFSET(node, bus, dev, fn) \
54 XLP_IO_PCI_OFFSET(bus, XLP_IO_DEV(node, dev), fn)
53 55
54#define XLP_IO_BRIDGE_OFFSET(node) XLP_HDR_OFFSET(node, 0, 0, 0) 56#define XLP_IO_BRIDGE_OFFSET(node) XLP_HDR_OFFSET(node, 0, 0, 0)
55/* coherent inter chip */ 57/* coherent inter chip */
@@ -109,6 +111,36 @@
109#define XLP_IO_MMC_OFFSET(node, slot) \ 111#define XLP_IO_MMC_OFFSET(node, slot) \
110 ((XLP_IO_SD_OFFSET(node))+(slot*0x100)+XLP_IO_PCI_HDRSZ) 112 ((XLP_IO_SD_OFFSET(node))+(slot*0x100)+XLP_IO_PCI_HDRSZ)
111 113
114/* Things have changed drastically in XLP 9XX */
115#define XLP9XX_HDR_OFFSET(n, d, f) \
116 XLP_IO_PCI_OFFSET(xlp9xx_get_socbus(n), d, f)
117
118#define XLP9XX_IO_BRIDGE_OFFSET(node) XLP_IO_PCI_OFFSET(0, 0, node)
119#define XLP9XX_IO_PIC_OFFSET(node) XLP9XX_HDR_OFFSET(node, 2, 0)
120#define XLP9XX_IO_UART_OFFSET(node) XLP9XX_HDR_OFFSET(node, 2, 2)
121#define XLP9XX_IO_SYS_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 0)
122#define XLP9XX_IO_FUSE_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 1)
123#define XLP9XX_IO_JTAG_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 4)
124
125#define XLP9XX_IO_PCIE_OFFSET(node, i) XLP9XX_HDR_OFFSET(node, 1, i)
126#define XLP9XX_IO_PCIE0_OFFSET(node) XLP9XX_HDR_OFFSET(node, 1, 0)
127#define XLP9XX_IO_PCIE2_OFFSET(node) XLP9XX_HDR_OFFSET(node, 1, 2)
128#define XLP9XX_IO_PCIE3_OFFSET(node) XLP9XX_HDR_OFFSET(node, 1, 3)
129
130/* XLP9xx USB block */
131#define XLP9XX_IO_USB_OFFSET(node, i) XLP9XX_HDR_OFFSET(node, 4, i)
132#define XLP9XX_IO_USB_XHCI0_OFFSET(node) XLP9XX_HDR_OFFSET(node, 4, 1)
133#define XLP9XX_IO_USB_XHCI1_OFFSET(node) XLP9XX_HDR_OFFSET(node, 4, 2)
134
135/* XLP9XX on-chip SATA controller */
136#define XLP9XX_IO_SATA_OFFSET(node) XLP9XX_HDR_OFFSET(node, 3, 2)
137
138#define XLP9XX_IO_NOR_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 0)
139#define XLP9XX_IO_NAND_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 1)
140#define XLP9XX_IO_SPI_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 2)
141/* SD flash */
142#define XLP9XX_IO_MMCSD_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 3)
143
112/* PCI config header register id's */ 144/* PCI config header register id's */
113#define XLP_PCI_CFGREG0 0x00 145#define XLP_PCI_CFGREG0 0x00
114#define XLP_PCI_CFGREG1 0x01 146#define XLP_PCI_CFGREG1 0x01
@@ -156,11 +188,23 @@
156#define PCI_DEVICE_ID_NLM_MMC 0x1018 188#define PCI_DEVICE_ID_NLM_MMC 0x1018
157#define PCI_DEVICE_ID_NLM_XHCI 0x101d 189#define PCI_DEVICE_ID_NLM_XHCI 0x101d
158 190
191#define PCI_DEVICE_ID_XLP9XX_SATA 0x901A
192#define PCI_DEVICE_ID_XLP9XX_XHCI 0x901D
193
159#ifndef __ASSEMBLY__ 194#ifndef __ASSEMBLY__
160 195
161#define nlm_read_pci_reg(b, r) nlm_read_reg(b, r) 196#define nlm_read_pci_reg(b, r) nlm_read_reg(b, r)
162#define nlm_write_pci_reg(b, r, v) nlm_write_reg(b, r, v) 197#define nlm_write_pci_reg(b, r, v) nlm_write_reg(b, r, v)
163 198
199static inline int xlp9xx_get_socbus(int node)
200{
201 uint64_t socbridge;
202
203 if (node == 0)
204 return 1;
205 socbridge = nlm_pcicfg_base(XLP9XX_IO_BRIDGE_OFFSET(node));
206 return (nlm_read_pci_reg(socbridge, 0x6) >> 8) & 0xff;
207}
164#endif /* !__ASSEMBLY */ 208#endif /* !__ASSEMBLY */
165 209
166#endif /* __NLM_HAL_IOMAP_H__ */ 210#endif /* __NLM_HAL_IOMAP_H__ */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h
index b559cb9f56ea..d4deb87ad069 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h
@@ -52,25 +52,48 @@
52#define PCIE_BYTE_SWAP_MEM_LIM 0x248 52#define PCIE_BYTE_SWAP_MEM_LIM 0x248
53#define PCIE_BYTE_SWAP_IO_BASE 0x249 53#define PCIE_BYTE_SWAP_IO_BASE 0x249
54#define PCIE_BYTE_SWAP_IO_LIM 0x24A 54#define PCIE_BYTE_SWAP_IO_LIM 0x24A
55
56#define PCIE_BRIDGE_MSIX_ADDR_BASE 0x24F
57#define PCIE_BRIDGE_MSIX_ADDR_LIMIT 0x250
55#define PCIE_MSI_STATUS 0x25A 58#define PCIE_MSI_STATUS 0x25A
56#define PCIE_MSI_EN 0x25B 59#define PCIE_MSI_EN 0x25B
60#define PCIE_MSIX_STATUS 0x25D
61#define PCIE_INT_STATUS0 0x25F
62#define PCIE_INT_STATUS1 0x260
57#define PCIE_INT_EN0 0x261 63#define PCIE_INT_EN0 0x261
64#define PCIE_INT_EN1 0x262
58 65
59/* PCIE_MSI_EN */ 66/* XLP9XX has basic changes */
60#define PCIE_MSI_VECTOR_INT_EN 0xFFFFFFFF 67#define PCIE_9XX_BYTE_SWAP_MEM_BASE 0x25c
68#define PCIE_9XX_BYTE_SWAP_MEM_LIM 0x25d
69#define PCIE_9XX_BYTE_SWAP_IO_BASE 0x25e
70#define PCIE_9XX_BYTE_SWAP_IO_LIM 0x25f
61 71
62/* PCIE_INT_EN0 */ 72/* other */
63#define PCIE_MSI_INT_EN (1 << 9) 73#define PCIE_NLINKS 4
64 74
75/* MSI addresses */
76#define MSI_ADDR_BASE 0xfffee00000ULL
77#define MSI_ADDR_SZ 0x10000
78#define MSI_LINK_ADDR(n, l) (MSI_ADDR_BASE + \
79 (PCIE_NLINKS * (n) + (l)) * MSI_ADDR_SZ)
80#define MSIX_ADDR_BASE 0xfffef00000ULL
81#define MSIX_LINK_ADDR(n, l) (MSIX_ADDR_BASE + \
82 (PCIE_NLINKS * (n) + (l)) * MSI_ADDR_SZ)
65#ifndef __ASSEMBLY__ 83#ifndef __ASSEMBLY__
66 84
67#define nlm_read_pcie_reg(b, r) nlm_read_reg(b, r) 85#define nlm_read_pcie_reg(b, r) nlm_read_reg(b, r)
68#define nlm_write_pcie_reg(b, r, v) nlm_write_reg(b, r, v) 86#define nlm_write_pcie_reg(b, r, v) nlm_write_reg(b, r, v)
69#define nlm_get_pcie_base(node, inst) \ 87#define nlm_get_pcie_base(node, inst) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
70 nlm_pcicfg_base(XLP_IO_PCIE_OFFSET(node, inst)) 88 XLP9XX_IO_PCIE_OFFSET(node, inst) : XLP_IO_PCIE_OFFSET(node, inst))
71#define nlm_get_pcie_regbase(node, inst) \ 89
72 (nlm_get_pcie_base(node, inst) + XLP_IO_PCI_HDRSZ) 90#ifdef CONFIG_PCI_MSI
91void xlp_init_node_msi_irqs(int node, int link);
92#else
93static inline void xlp_init_node_msi_irqs(int node, int link) {}
94#endif
95
96struct pci_dev *xlp_get_pcie_link(const struct pci_dev *dev);
73 97
74int xlp_pcie_link_irt(int link);
75#endif 98#endif
76#endif /* __NLM_HAL_PCIBUS_H__ */ 99#endif /* __NLM_HAL_PCIBUS_H__ */
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pic.h b/arch/mips/include/asm/netlogic/xlp-hal/pic.h
index 105389b79f09..f10bf3bba58f 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/pic.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/pic.h
@@ -150,12 +150,19 @@
150#define PIC_IRT0 0x74 150#define PIC_IRT0 0x74
151#define PIC_IRT(i) (PIC_IRT0 + ((i) * 2)) 151#define PIC_IRT(i) (PIC_IRT0 + ((i) * 2))
152 152
153#define TIMER_CYCLES_MAXVAL 0xffffffffffffffffULL 153#define PIC_9XX_PENDING_0 0x6
154#define PIC_9XX_PENDING_1 0x8
155#define PIC_9XX_PENDING_2 0xa
156#define PIC_9XX_PENDING_3 0xc
157
158#define PIC_9XX_IRT0 0x1c0
159#define PIC_9XX_IRT(i) (PIC_9XX_IRT0 + ((i) * 2))
154 160
155/* 161/*
156 * IRT Map 162 * IRT Map
157 */ 163 */
158#define PIC_NUM_IRTS 160 164#define PIC_NUM_IRTS 160
165#define PIC_9XX_NUM_IRTS 256
159 166
160#define PIC_IRT_WD_0_INDEX 0 167#define PIC_IRT_WD_0_INDEX 0
161#define PIC_IRT_WD_1_INDEX 1 168#define PIC_IRT_WD_1_INDEX 1
@@ -193,14 +200,9 @@
193#define PIC_IRT_PCIE_LINK_INDEX(num) ((num) + PIC_IRT_PCIE_LINK_0_INDEX) 200#define PIC_IRT_PCIE_LINK_INDEX(num) ((num) + PIC_IRT_PCIE_LINK_0_INDEX)
194 201
195#define PIC_CLOCK_TIMER 7 202#define PIC_CLOCK_TIMER 7
196#define PIC_IRQ_BASE 8
197 203
198#if !defined(LOCORE) && !defined(__ASSEMBLY__) 204#if !defined(LOCORE) && !defined(__ASSEMBLY__)
199 205
200#define PIC_IRT_FIRST_IRQ (PIC_IRQ_BASE)
201#define PIC_IRT_LAST_IRQ 63
202#define PIC_IRQ_IS_IRT(irq) ((irq) >= PIC_IRT_FIRST_IRQ)
203
204/* 206/*
205 * Misc 207 * Misc
206 */ 208 */
@@ -210,30 +212,26 @@
210 212
211#define nlm_read_pic_reg(b, r) nlm_read_reg64(b, r) 213#define nlm_read_pic_reg(b, r) nlm_read_reg64(b, r)
212#define nlm_write_pic_reg(b, r, v) nlm_write_reg64(b, r, v) 214#define nlm_write_pic_reg(b, r, v) nlm_write_reg64(b, r, v)
213#define nlm_get_pic_pcibase(node) nlm_pcicfg_base(XLP_IO_PIC_OFFSET(node)) 215#define nlm_get_pic_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
216 XLP9XX_IO_PIC_OFFSET(node) : XLP_IO_PIC_OFFSET(node))
214#define nlm_get_pic_regbase(node) (nlm_get_pic_pcibase(node) + XLP_IO_PCI_HDRSZ) 217#define nlm_get_pic_regbase(node) (nlm_get_pic_pcibase(node) + XLP_IO_PCI_HDRSZ)
215 218
216/* We use PIC on node 0 as a timer */ 219/* We use PIC on node 0 as a timer */
217#define pic_timer_freq() nlm_get_pic_frequency(0) 220#define pic_timer_freq() nlm_get_pic_frequency(0)
218 221
219/* IRT and h/w interrupt routines */ 222/* IRT and h/w interrupt routines */
220static inline int
221nlm_pic_read_irt(uint64_t base, int irt_index)
222{
223 return nlm_read_pic_reg(base, PIC_IRT(irt_index));
224}
225
226static inline void 223static inline void
227nlm_set_irt_to_cpu(uint64_t base, int irt, int cpu) 224nlm_9xx_pic_write_irt(uint64_t base, int irt_num, int en, int nmi,
225 int sch, int vec, int dt, int db, int cpu)
228{ 226{
229 uint64_t val; 227 uint64_t val;
230 228
231 val = nlm_read_pic_reg(base, PIC_IRT(irt)); 229 val = (((uint64_t)en & 0x1) << 22) | ((nmi & 0x1) << 23) |
232 /* clear cpuset and mask */ 230 ((0 /*mc*/) << 20) | ((vec & 0x3f) << 24) |
233 val &= ~((0x7ull << 16) | 0xffff); 231 ((dt & 0x1) << 21) | (0 /*ptr*/ << 16) |
234 /* set DB, cpuset and cpumask */ 232 (cpu & 0x3ff);
235 val |= (1 << 19) | ((cpu >> 4) << 16) | (1 << (cpu & 0xf)); 233
236 nlm_write_pic_reg(base, PIC_IRT(irt), val); 234 nlm_write_pic_reg(base, PIC_9XX_IRT(irt_num), val);
237} 235}
238 236
239static inline void 237static inline void
@@ -254,9 +252,13 @@ static inline void
254nlm_pic_write_irt_direct(uint64_t base, int irt_num, int en, int nmi, 252nlm_pic_write_irt_direct(uint64_t base, int irt_num, int en, int nmi,
255 int sch, int vec, int cpu) 253 int sch, int vec, int cpu)
256{ 254{
257 nlm_pic_write_irt(base, irt_num, en, nmi, sch, vec, 1, 255 if (cpu_is_xlp9xx())
258 (cpu >> 4), /* thread group */ 256 nlm_9xx_pic_write_irt(base, irt_num, en, nmi, sch, vec,
259 1 << (cpu & 0xf)); /* thread mask */ 257 1, 0, cpu);
258 else
259 nlm_pic_write_irt(base, irt_num, en, nmi, sch, vec, 1,
260 (cpu >> 4), /* thread group */
261 1 << (cpu & 0xf)); /* thread mask */
260} 262}
261 263
262static inline uint64_t 264static inline uint64_t
@@ -298,8 +300,13 @@ nlm_pic_enable_irt(uint64_t base, int irt)
298{ 300{
299 uint64_t reg; 301 uint64_t reg;
300 302
301 reg = nlm_read_pic_reg(base, PIC_IRT(irt)); 303 if (cpu_is_xlp9xx()) {
302 nlm_write_pic_reg(base, PIC_IRT(irt), reg | (1u << 31)); 304 reg = nlm_read_pic_reg(base, PIC_9XX_IRT(irt));
305 nlm_write_pic_reg(base, PIC_9XX_IRT(irt), reg | (1 << 22));
306 } else {
307 reg = nlm_read_pic_reg(base, PIC_IRT(irt));
308 nlm_write_pic_reg(base, PIC_IRT(irt), reg | (1u << 31));
309 }
303} 310}
304 311
305static inline void 312static inline void
@@ -307,8 +314,15 @@ nlm_pic_disable_irt(uint64_t base, int irt)
307{ 314{
308 uint64_t reg; 315 uint64_t reg;
309 316
310 reg = nlm_read_pic_reg(base, PIC_IRT(irt)); 317 if (cpu_is_xlp9xx()) {
311 nlm_write_pic_reg(base, PIC_IRT(irt), reg & ~((uint64_t)1 << 31)); 318 reg = nlm_read_pic_reg(base, PIC_9XX_IRT(irt));
319 reg &= ~((uint64_t)1 << 22);
320 nlm_write_pic_reg(base, PIC_9XX_IRT(irt), reg);
321 } else {
322 reg = nlm_read_pic_reg(base, PIC_IRT(irt));
323 reg &= ~((uint64_t)1 << 31);
324 nlm_write_pic_reg(base, PIC_IRT(irt), reg);
325 }
312} 326}
313 327
314static inline void 328static inline void
@@ -316,8 +330,13 @@ nlm_pic_send_ipi(uint64_t base, int hwt, int irq, int nmi)
316{ 330{
317 uint64_t ipi; 331 uint64_t ipi;
318 332
319 ipi = ((uint64_t)nmi << 31) | (irq << 20); 333 if (cpu_is_xlp9xx())
320 ipi |= ((hwt >> 4) << 16) | (1 << (hwt & 0xf)); /* cpuset and mask */ 334 ipi = (nmi << 23) | (irq << 24) |
335 (0/*mcm*/ << 20) | (0/*ptr*/ << 16) | hwt;
336 else
337 ipi = ((uint64_t)nmi << 31) | (irq << 20) |
338 ((hwt >> 4) << 16) | (1 << (hwt & 0xf));
339
321 nlm_write_pic_reg(base, PIC_IPI_CTL, ipi); 340 nlm_write_pic_reg(base, PIC_IPI_CTL, ipi);
322} 341}
323 342
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/sys.h b/arch/mips/include/asm/netlogic/xlp-hal/sys.h
index fcf2833c16ca..d9b107ffca93 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/sys.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/sys.h
@@ -147,13 +147,29 @@
147#define SYS_SYS_PLL_MEM_REQ 0x2a3 147#define SYS_SYS_PLL_MEM_REQ 0x2a3
148#define SYS_PLL_MEM_STAT 0x2a4 148#define SYS_PLL_MEM_STAT 0x2a4
149 149
150/* Registers changed on 9XX */
151#define SYS_9XX_POWER_ON_RESET_CFG 0x00
152#define SYS_9XX_CHIP_RESET 0x01
153#define SYS_9XX_CPU_RESET 0x02
154#define SYS_9XX_CPU_NONCOHERENT_MODE 0x03
155
156/* XLP 9XX fuse block registers */
157#define FUSE_9XX_DEVCFG6 0xc6
158
150#ifndef __ASSEMBLY__ 159#ifndef __ASSEMBLY__
151 160
152#define nlm_read_sys_reg(b, r) nlm_read_reg(b, r) 161#define nlm_read_sys_reg(b, r) nlm_read_reg(b, r)
153#define nlm_write_sys_reg(b, r, v) nlm_write_reg(b, r, v) 162#define nlm_write_sys_reg(b, r, v) nlm_write_reg(b, r, v)
154#define nlm_get_sys_pcibase(node) nlm_pcicfg_base(XLP_IO_SYS_OFFSET(node)) 163#define nlm_get_sys_pcibase(node) nlm_pcicfg_base(cpu_is_xlp9xx() ? \
164 XLP9XX_IO_SYS_OFFSET(node) : XLP_IO_SYS_OFFSET(node))
155#define nlm_get_sys_regbase(node) (nlm_get_sys_pcibase(node) + XLP_IO_PCI_HDRSZ) 165#define nlm_get_sys_regbase(node) (nlm_get_sys_pcibase(node) + XLP_IO_PCI_HDRSZ)
156 166
167/* XLP9XX fuse block */
168#define nlm_get_fuse_pcibase(node) \
169 nlm_pcicfg_base(XLP9XX_IO_FUSE_OFFSET(node))
170#define nlm_get_fuse_regbase(node) \
171 (nlm_get_fuse_pcibase(node) + XLP_IO_PCI_HDRSZ)
172
157unsigned int nlm_get_pic_frequency(int node); 173unsigned int nlm_get_pic_frequency(int node);
158#endif 174#endif
159#endif 175#endif
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/uart.h b/arch/mips/include/asm/netlogic/xlp-hal/uart.h
index 86d16e1e6072..a6c54424dd95 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/uart.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/uart.h
@@ -94,7 +94,8 @@
94#define nlm_read_uart_reg(b, r) nlm_read_reg(b, r) 94#define nlm_read_uart_reg(b, r) nlm_read_reg(b, r)
95#define nlm_write_uart_reg(b, r, v) nlm_write_reg(b, r, v) 95#define nlm_write_uart_reg(b, r, v) nlm_write_reg(b, r, v)
96#define nlm_get_uart_pcibase(node, inst) \ 96#define nlm_get_uart_pcibase(node, inst) \
97 nlm_pcicfg_base(XLP_IO_UART_OFFSET(node, inst)) 97 nlm_pcicfg_base(cpu_is_xlp9xx() ? XLP9XX_IO_UART_OFFSET(node) : \
98 XLP_IO_UART_OFFSET(node, inst))
98#define nlm_get_uart_regbase(node, inst) \ 99#define nlm_get_uart_regbase(node, inst) \
99 (nlm_get_uart_pcibase(node, inst) + XLP_IO_PCI_HDRSZ) 100 (nlm_get_uart_pcibase(node, inst) + XLP_IO_PCI_HDRSZ)
100 101
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
index 470f2095b346..2b0c9599ebe5 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
@@ -37,10 +37,9 @@
37 37
38#define PIC_UART_0_IRQ 17 38#define PIC_UART_0_IRQ 17
39#define PIC_UART_1_IRQ 18 39#define PIC_UART_1_IRQ 18
40#define PIC_PCIE_LINK_0_IRQ 19 40
41#define PIC_PCIE_LINK_1_IRQ 20 41#define PIC_PCIE_LINK_LEGACY_IRQ_BASE 19
42#define PIC_PCIE_LINK_2_IRQ 21 42#define PIC_PCIE_LINK_LEGACY_IRQ(i) (19 + (i))
43#define PIC_PCIE_LINK_3_IRQ 22
44 43
45#define PIC_EHCI_0_IRQ 23 44#define PIC_EHCI_0_IRQ 23
46#define PIC_EHCI_1_IRQ 24 45#define PIC_EHCI_1_IRQ 24
@@ -51,6 +50,8 @@
51#define PIC_2XX_XHCI_0_IRQ 23 50#define PIC_2XX_XHCI_0_IRQ 23
52#define PIC_2XX_XHCI_1_IRQ 24 51#define PIC_2XX_XHCI_1_IRQ 24
53#define PIC_2XX_XHCI_2_IRQ 25 52#define PIC_2XX_XHCI_2_IRQ 25
53#define PIC_9XX_XHCI_0_IRQ 23
54#define PIC_9XX_XHCI_1_IRQ 24
54 55
55#define PIC_MMC_IRQ 29 56#define PIC_MMC_IRQ 29
56#define PIC_I2C_0_IRQ 30 57#define PIC_I2C_0_IRQ 30
@@ -58,6 +59,23 @@
58#define PIC_I2C_2_IRQ 32 59#define PIC_I2C_2_IRQ 32
59#define PIC_I2C_3_IRQ 33 60#define PIC_I2C_3_IRQ 33
60 61
62#define PIC_PCIE_LINK_MSI_IRQ_BASE 44 /* 44 - 47 MSI IRQ */
63#define PIC_PCIE_LINK_MSI_IRQ(i) (44 + (i))
64
65/* MSI-X with second link-level dispatch */
66#define PIC_PCIE_MSIX_IRQ_BASE 48 /* 48 - 51 MSI-X IRQ */
67#define PIC_PCIE_MSIX_IRQ(i) (48 + (i))
68
69#define NLM_MSIX_VEC_BASE 96 /* 96 - 127 - MSIX mapped */
70#define NLM_MSI_VEC_BASE 128 /* 128 -255 - MSI mapped */
71
72#define NLM_PIC_INDIRECT_VEC_BASE 512
73#define NLM_GPIO_VEC_BASE 768
74
75#define PIC_IRQ_BASE 8
76#define PIC_IRT_FIRST_IRQ PIC_IRQ_BASE
77#define PIC_IRT_LAST_IRQ 63
78
61#ifndef __ASSEMBLY__ 79#ifndef __ASSEMBLY__
62 80
63/* SMP support functions */ 81/* SMP support functions */
@@ -68,6 +86,9 @@ void xlp_mmu_init(void);
68void nlm_hal_init(void); 86void nlm_hal_init(void);
69int xlp_get_dram_map(int n, uint64_t *dram_map); 87int xlp_get_dram_map(int n, uint64_t *dram_map);
70 88
89struct pci_dev;
90int xlp_socdev_to_node(const struct pci_dev *dev);
91
71/* Device tree related */ 92/* Device tree related */
72void xlp_early_init_devtree(void); 93void xlp_early_init_devtree(void);
73void *xlp_dt_init(void *fdtp); 94void *xlp_dt_init(void *fdtp);
@@ -76,8 +97,15 @@ static inline int cpu_is_xlpii(void)
76{ 97{
77 int chip = read_c0_prid() & 0xff00; 98 int chip = read_c0_prid() & 0xff00;
78 99
79 return chip == PRID_IMP_NETLOGIC_XLP2XX; 100 return chip == PRID_IMP_NETLOGIC_XLP2XX ||
101 chip == PRID_IMP_NETLOGIC_XLP9XX;
80} 102}
81 103
104static inline int cpu_is_xlp9xx(void)
105{
106 int chip = read_c0_prid() & 0xff00;
107
108 return chip == PRID_IMP_NETLOGIC_XLP9XX;
109}
82#endif /* !__ASSEMBLY__ */ 110#endif /* !__ASSEMBLY__ */
83#endif /* _ASM_NLM_XLP_H */ 111#endif /* _ASM_NLM_XLP_H */
diff --git a/arch/mips/include/asm/netlogic/xlr/xlr.h b/arch/mips/include/asm/netlogic/xlr/xlr.h
index c1667e0c272a..ceb991ca8436 100644
--- a/arch/mips/include/asm/netlogic/xlr/xlr.h
+++ b/arch/mips/include/asm/netlogic/xlr/xlr.h
@@ -35,11 +35,6 @@
35#ifndef _ASM_NLM_XLR_H 35#ifndef _ASM_NLM_XLR_H
36#define _ASM_NLM_XLR_H 36#define _ASM_NLM_XLR_H
37 37
38/* Platform UART functions */
39struct uart_port;
40unsigned int nlm_xlr_uart_in(struct uart_port *, int);
41void nlm_xlr_uart_out(struct uart_port *, int, int);
42
43/* SMP helpers */ 38/* SMP helpers */
44void xlr_wakeup_secondary_cpus(void); 39void xlr_wakeup_secondary_cpus(void);
45 40