diff options
Diffstat (limited to 'arch/mips/netlogic')
-rw-r--r-- | arch/mips/netlogic/Kconfig | 9 | ||||
-rw-r--r-- | arch/mips/netlogic/common/irq.c | 10 | ||||
-rw-r--r-- | arch/mips/netlogic/common/reset.S | 22 | ||||
-rw-r--r-- | arch/mips/netlogic/common/smp.c | 25 | ||||
-rw-r--r-- | arch/mips/netlogic/common/time.c | 1 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/ahci-init-xlp2.c | 13 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/ahci-init.c | 2 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/dt.c | 10 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/nlm_hal.c | 57 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/setup.c | 7 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/usb-init-xlp2.c | 10 | ||||
-rw-r--r-- | arch/mips/netlogic/xlp/wakeup.c | 10 |
12 files changed, 123 insertions, 53 deletions
diff --git a/arch/mips/netlogic/Kconfig b/arch/mips/netlogic/Kconfig index 0823321c10e0..fb00606e352d 100644 --- a/arch/mips/netlogic/Kconfig +++ b/arch/mips/netlogic/Kconfig | |||
@@ -41,6 +41,15 @@ config DT_XLP_GVP | |||
41 | pointer to the kernel. The corresponding DTS file is at | 41 | pointer to the kernel. The corresponding DTS file is at |
42 | arch/mips/netlogic/dts/xlp_gvp.dts | 42 | arch/mips/netlogic/dts/xlp_gvp.dts |
43 | 43 | ||
44 | config DT_XLP_RVP | ||
45 | bool "Built-in device tree for XLP RVP boards" | ||
46 | default y | ||
47 | help | ||
48 | Add an FDT blob for XLP RVP board into the kernel. | ||
49 | This DTB will be used if the firmware does not pass in a DTB | ||
50 | pointer to the kernel. The corresponding DTS file is at | ||
51 | arch/mips/netlogic/dts/xlp_rvp.dts | ||
52 | |||
44 | config NLM_MULTINODE | 53 | config NLM_MULTINODE |
45 | bool "Support for multi-chip boards" | 54 | bool "Support for multi-chip boards" |
46 | depends on NLM_XLP_BOARD | 55 | depends on NLM_XLP_BOARD |
diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c index c100b9afa0ab..5f5d18b0e94d 100644 --- a/arch/mips/netlogic/common/irq.c +++ b/arch/mips/netlogic/common/irq.c | |||
@@ -230,16 +230,16 @@ static void nlm_init_node_irqs(int node) | |||
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | void nlm_smp_irq_init(int hwcpuid) | 233 | void nlm_smp_irq_init(int hwtid) |
234 | { | 234 | { |
235 | int node, cpu; | 235 | int cpu, node; |
236 | 236 | ||
237 | node = nlm_cpuid_to_node(hwcpuid); | 237 | cpu = hwtid % nlm_threads_per_node(); |
238 | cpu = hwcpuid % nlm_threads_per_node(); | 238 | node = hwtid / nlm_threads_per_node(); |
239 | 239 | ||
240 | if (cpu == 0 && node != 0) | 240 | if (cpu == 0 && node != 0) |
241 | nlm_init_node_irqs(node); | 241 | nlm_init_node_irqs(node); |
242 | write_c0_eimr(nlm_current_node()->irqmask); | 242 | write_c0_eimr(nlm_get_node(node)->irqmask); |
243 | } | 243 | } |
244 | 244 | ||
245 | asmlinkage void plat_irq_dispatch(void) | 245 | asmlinkage void plat_irq_dispatch(void) |
diff --git a/arch/mips/netlogic/common/reset.S b/arch/mips/netlogic/common/reset.S index 701c4bcb9e47..edbab9b8691f 100644 --- a/arch/mips/netlogic/common/reset.S +++ b/arch/mips/netlogic/common/reset.S | |||
@@ -60,7 +60,7 @@ | |||
60 | li t0, LSU_DEFEATURE | 60 | li t0, LSU_DEFEATURE |
61 | mfcr t1, t0 | 61 | mfcr t1, t0 |
62 | 62 | ||
63 | lui t2, 0xc080 /* SUE, Enable Unaligned Access, L2HPE */ | 63 | lui t2, 0x4080 /* Enable Unaligned Access, L2HPE */ |
64 | or t1, t1, t2 | 64 | or t1, t1, t2 |
65 | mtcr t1, t0 | 65 | mtcr t1, t0 |
66 | 66 | ||
@@ -235,6 +235,26 @@ EXPORT(nlm_boot_siblings) | |||
235 | mfc0 v0, CP0_EBASE, 1 | 235 | mfc0 v0, CP0_EBASE, 1 |
236 | andi v0, 0x3ff /* v0 <- node/core */ | 236 | andi v0, 0x3ff /* v0 <- node/core */ |
237 | 237 | ||
238 | /* | ||
239 | * Errata: to avoid potential live lock, setup IFU_BRUB_RESERVE | ||
240 | * when running 4 threads per core | ||
241 | */ | ||
242 | andi v1, v0, 0x3 /* v1 <- thread id */ | ||
243 | bnez v1, 2f | ||
244 | nop | ||
245 | |||
246 | /* thread 0 of each core. */ | ||
247 | li t0, CKSEG1ADDR(RESET_DATA_PHYS) | ||
248 | lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */ | ||
249 | subu t1, 0x3 /* 4-thread per core mode? */ | ||
250 | bnez t1, 2f | ||
251 | nop | ||
252 | |||
253 | li t0, IFU_BRUB_RESERVE | ||
254 | li t1, 0x55 | ||
255 | mtcr t1, t0 | ||
256 | _ehb | ||
257 | 2: | ||
238 | beqz v0, 4f /* boot cpu (cpuid == 0)? */ | 258 | beqz v0, 4f /* boot cpu (cpuid == 0)? */ |
239 | nop | 259 | nop |
240 | 260 | ||
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c index e743bdd6e20c..dc3e327fbbac 100644 --- a/arch/mips/netlogic/common/smp.c +++ b/arch/mips/netlogic/common/smp.c | |||
@@ -59,17 +59,17 @@ | |||
59 | 59 | ||
60 | void nlm_send_ipi_single(int logical_cpu, unsigned int action) | 60 | void nlm_send_ipi_single(int logical_cpu, unsigned int action) |
61 | { | 61 | { |
62 | int cpu, node; | 62 | unsigned int hwtid; |
63 | uint64_t picbase; | 63 | uint64_t picbase; |
64 | 64 | ||
65 | cpu = cpu_logical_map(logical_cpu); | 65 | /* node id is part of hwtid, and needed for send_ipi */ |
66 | node = nlm_cpuid_to_node(cpu); | 66 | hwtid = cpu_logical_map(logical_cpu); |
67 | picbase = nlm_get_node(node)->picbase; | 67 | picbase = nlm_get_node(nlm_hwtid_to_node(hwtid))->picbase; |
68 | 68 | ||
69 | if (action & SMP_CALL_FUNCTION) | 69 | if (action & SMP_CALL_FUNCTION) |
70 | nlm_pic_send_ipi(picbase, cpu, IRQ_IPI_SMP_FUNCTION, 0); | 70 | nlm_pic_send_ipi(picbase, hwtid, IRQ_IPI_SMP_FUNCTION, 0); |
71 | if (action & SMP_RESCHEDULE_YOURSELF) | 71 | if (action & SMP_RESCHEDULE_YOURSELF) |
72 | nlm_pic_send_ipi(picbase, cpu, IRQ_IPI_SMP_RESCHEDULE, 0); | 72 | nlm_pic_send_ipi(picbase, hwtid, IRQ_IPI_SMP_RESCHEDULE, 0); |
73 | } | 73 | } |
74 | 74 | ||
75 | void nlm_send_ipi_mask(const struct cpumask *mask, unsigned int action) | 75 | void nlm_send_ipi_mask(const struct cpumask *mask, unsigned int action) |
@@ -120,6 +120,7 @@ static void nlm_init_secondary(void) | |||
120 | 120 | ||
121 | hwtid = hard_smp_processor_id(); | 121 | hwtid = hard_smp_processor_id(); |
122 | current_cpu_data.core = hwtid / NLM_THREADS_PER_CORE; | 122 | current_cpu_data.core = hwtid / NLM_THREADS_PER_CORE; |
123 | current_cpu_data.package = nlm_nodeid(); | ||
123 | nlm_percpu_init(hwtid); | 124 | nlm_percpu_init(hwtid); |
124 | nlm_smp_irq_init(hwtid); | 125 | nlm_smp_irq_init(hwtid); |
125 | } | 126 | } |
@@ -145,16 +146,18 @@ static cpumask_t phys_cpu_present_mask; | |||
145 | 146 | ||
146 | void nlm_boot_secondary(int logical_cpu, struct task_struct *idle) | 147 | void nlm_boot_secondary(int logical_cpu, struct task_struct *idle) |
147 | { | 148 | { |
148 | int cpu, node; | 149 | uint64_t picbase; |
150 | int hwtid; | ||
151 | |||
152 | hwtid = cpu_logical_map(logical_cpu); | ||
153 | picbase = nlm_get_node(nlm_hwtid_to_node(hwtid))->picbase; | ||
149 | 154 | ||
150 | cpu = cpu_logical_map(logical_cpu); | ||
151 | node = nlm_cpuid_to_node(logical_cpu); | ||
152 | nlm_next_sp = (unsigned long)__KSTK_TOS(idle); | 155 | nlm_next_sp = (unsigned long)__KSTK_TOS(idle); |
153 | nlm_next_gp = (unsigned long)task_thread_info(idle); | 156 | nlm_next_gp = (unsigned long)task_thread_info(idle); |
154 | 157 | ||
155 | /* barrier for sp/gp store above */ | 158 | /* barrier for sp/gp store above */ |
156 | __sync(); | 159 | __sync(); |
157 | nlm_pic_send_ipi(nlm_get_node(node)->picbase, cpu, 1, 1); /* NMI */ | 160 | nlm_pic_send_ipi(picbase, hwtid, 1, 1); /* NMI */ |
158 | } | 161 | } |
159 | 162 | ||
160 | void __init nlm_smp_setup(void) | 163 | void __init nlm_smp_setup(void) |
@@ -182,7 +185,7 @@ void __init nlm_smp_setup(void) | |||
182 | __cpu_number_map[i] = num_cpus; | 185 | __cpu_number_map[i] = num_cpus; |
183 | __cpu_logical_map[num_cpus] = i; | 186 | __cpu_logical_map[num_cpus] = i; |
184 | set_cpu_possible(num_cpus, true); | 187 | set_cpu_possible(num_cpus, true); |
185 | node = nlm_cpuid_to_node(i); | 188 | node = nlm_hwtid_to_node(i); |
186 | cpumask_set_cpu(num_cpus, &nlm_get_node(node)->cpumask); | 189 | cpumask_set_cpu(num_cpus, &nlm_get_node(node)->cpumask); |
187 | ++num_cpus; | 190 | ++num_cpus; |
188 | } | 191 | } |
diff --git a/arch/mips/netlogic/common/time.c b/arch/mips/netlogic/common/time.c index 0c0a1a606f73..5873c83e65be 100644 --- a/arch/mips/netlogic/common/time.c +++ b/arch/mips/netlogic/common/time.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <asm/netlogic/interrupt.h> | 40 | #include <asm/netlogic/interrupt.h> |
41 | #include <asm/netlogic/common.h> | 41 | #include <asm/netlogic/common.h> |
42 | #include <asm/netlogic/haldefs.h> | 42 | #include <asm/netlogic/haldefs.h> |
43 | #include <asm/netlogic/common.h> | ||
44 | 43 | ||
45 | #if defined(CONFIG_CPU_XLP) | 44 | #if defined(CONFIG_CPU_XLP) |
46 | #include <asm/netlogic/xlp-hal/iomap.h> | 45 | #include <asm/netlogic/xlp-hal/iomap.h> |
diff --git a/arch/mips/netlogic/xlp/ahci-init-xlp2.c b/arch/mips/netlogic/xlp/ahci-init-xlp2.c index c83dbf3689e2..7b066a44e679 100644 --- a/arch/mips/netlogic/xlp/ahci-init-xlp2.c +++ b/arch/mips/netlogic/xlp/ahci-init-xlp2.c | |||
@@ -203,6 +203,7 @@ static u8 read_phy_reg(u64 regbase, u32 addr, u32 physel) | |||
203 | static void config_sata_phy(u64 regbase) | 203 | static void config_sata_phy(u64 regbase) |
204 | { | 204 | { |
205 | u32 port, i, reg; | 205 | u32 port, i, reg; |
206 | u8 val; | ||
206 | 207 | ||
207 | for (port = 0; port < 2; port++) { | 208 | for (port = 0; port < 2; port++) { |
208 | for (i = 0, reg = RXCDRCALFOSC0; reg <= CALDUTY; reg++, i++) | 209 | for (i = 0, reg = RXCDRCALFOSC0; reg <= CALDUTY; reg++, i++) |
@@ -210,6 +211,18 @@ static void config_sata_phy(u64 regbase) | |||
210 | 211 | ||
211 | for (i = 0, reg = RXDPIF; reg <= PPMDRIFTMAX_HI; reg++, i++) | 212 | for (i = 0, reg = RXDPIF; reg <= PPMDRIFTMAX_HI; reg++, i++) |
212 | write_phy_reg(regbase, reg, port, sata_phy_config2[i]); | 213 | write_phy_reg(regbase, reg, port, sata_phy_config2[i]); |
214 | |||
215 | /* Fix for PHY link up failures at lower temperatures */ | ||
216 | write_phy_reg(regbase, 0x800F, port, 0x1f); | ||
217 | |||
218 | val = read_phy_reg(regbase, 0x0029, port); | ||
219 | write_phy_reg(regbase, 0x0029, port, val | (0x7 << 1)); | ||
220 | |||
221 | val = read_phy_reg(regbase, 0x0056, port); | ||
222 | write_phy_reg(regbase, 0x0056, port, val & ~(1 << 3)); | ||
223 | |||
224 | val = read_phy_reg(regbase, 0x0018, port); | ||
225 | write_phy_reg(regbase, 0x0018, port, val & ~(0x7 << 0)); | ||
213 | } | 226 | } |
214 | } | 227 | } |
215 | 228 | ||
diff --git a/arch/mips/netlogic/xlp/ahci-init.c b/arch/mips/netlogic/xlp/ahci-init.c index a9d0fae02103..92be1a3258b1 100644 --- a/arch/mips/netlogic/xlp/ahci-init.c +++ b/arch/mips/netlogic/xlp/ahci-init.c | |||
@@ -151,7 +151,7 @@ static void nlm_sata_firmware_init(int node) | |||
151 | static int __init nlm_ahci_init(void) | 151 | static int __init nlm_ahci_init(void) |
152 | { | 152 | { |
153 | int node = 0; | 153 | int node = 0; |
154 | int chip = read_c0_prid() & PRID_REV_MASK; | 154 | int chip = read_c0_prid() & PRID_IMP_MASK; |
155 | 155 | ||
156 | if (chip == PRID_IMP_NETLOGIC_XLP3XX) | 156 | if (chip == PRID_IMP_NETLOGIC_XLP3XX) |
157 | nlm_sata_firmware_init(node); | 157 | nlm_sata_firmware_init(node); |
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c index 7cc46032b28e..a625bdb6d6aa 100644 --- a/arch/mips/netlogic/xlp/dt.c +++ b/arch/mips/netlogic/xlp/dt.c | |||
@@ -41,17 +41,21 @@ | |||
41 | 41 | ||
42 | #include <asm/prom.h> | 42 | #include <asm/prom.h> |
43 | 43 | ||
44 | extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], | 44 | extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], __dtb_xlp_fvp_begin[], |
45 | __dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[]; | 45 | __dtb_xlp_gvp_begin[], __dtb_xlp_rvp_begin[]; |
46 | static void *xlp_fdt_blob; | 46 | static void *xlp_fdt_blob; |
47 | 47 | ||
48 | void __init *xlp_dt_init(void *fdtp) | 48 | void __init *xlp_dt_init(void *fdtp) |
49 | { | 49 | { |
50 | if (!fdtp) { | 50 | if (!fdtp) { |
51 | switch (current_cpu_data.processor_id & PRID_IMP_MASK) { | 51 | switch (current_cpu_data.processor_id & PRID_IMP_MASK) { |
52 | #ifdef CONFIG_DT_XLP_RVP | ||
53 | case PRID_IMP_NETLOGIC_XLP5XX: | ||
54 | fdtp = __dtb_xlp_rvp_begin; | ||
55 | break; | ||
56 | #endif | ||
52 | #ifdef CONFIG_DT_XLP_GVP | 57 | #ifdef CONFIG_DT_XLP_GVP |
53 | case PRID_IMP_NETLOGIC_XLP9XX: | 58 | case PRID_IMP_NETLOGIC_XLP9XX: |
54 | case PRID_IMP_NETLOGIC_XLP5XX: | ||
55 | fdtp = __dtb_xlp_gvp_begin; | 59 | fdtp = __dtb_xlp_gvp_begin; |
56 | break; | 60 | break; |
57 | #endif | 61 | #endif |
diff --git a/arch/mips/netlogic/xlp/nlm_hal.c b/arch/mips/netlogic/xlp/nlm_hal.c index bc24beb3a426..a8f4144a0297 100644 --- a/arch/mips/netlogic/xlp/nlm_hal.c +++ b/arch/mips/netlogic/xlp/nlm_hal.c | |||
@@ -71,10 +71,20 @@ static int xlp9xx_irq_to_irt(int irq) | |||
71 | switch (irq) { | 71 | switch (irq) { |
72 | case PIC_GPIO_IRQ: | 72 | case PIC_GPIO_IRQ: |
73 | return 12; | 73 | return 12; |
74 | case PIC_I2C_0_IRQ: | ||
75 | return 125; | ||
76 | case PIC_I2C_1_IRQ: | ||
77 | return 126; | ||
78 | case PIC_I2C_2_IRQ: | ||
79 | return 127; | ||
80 | case PIC_I2C_3_IRQ: | ||
81 | return 128; | ||
74 | case PIC_9XX_XHCI_0_IRQ: | 82 | case PIC_9XX_XHCI_0_IRQ: |
75 | return 114; | 83 | return 114; |
76 | case PIC_9XX_XHCI_1_IRQ: | 84 | case PIC_9XX_XHCI_1_IRQ: |
77 | return 115; | 85 | return 115; |
86 | case PIC_9XX_XHCI_2_IRQ: | ||
87 | return 116; | ||
78 | case PIC_UART_0_IRQ: | 88 | case PIC_UART_0_IRQ: |
79 | return 133; | 89 | return 133; |
80 | case PIC_UART_1_IRQ: | 90 | case PIC_UART_1_IRQ: |
@@ -170,16 +180,23 @@ static int xlp_irq_to_irt(int irq) | |||
170 | } | 180 | } |
171 | 181 | ||
172 | if (devoff != 0) { | 182 | if (devoff != 0) { |
183 | uint32_t val; | ||
184 | |||
173 | pcibase = nlm_pcicfg_base(devoff); | 185 | pcibase = nlm_pcicfg_base(devoff); |
174 | irt = nlm_read_reg(pcibase, XLP_PCI_IRTINFO_REG) & 0xffff; | 186 | val = nlm_read_reg(pcibase, XLP_PCI_IRTINFO_REG); |
175 | /* HW weirdness, I2C IRT entry has to be fixed up */ | 187 | if (val == 0xffffffff) { |
176 | switch (irq) { | 188 | irt = -1; |
177 | case PIC_I2C_1_IRQ: | 189 | } else { |
178 | irt = irt + 1; break; | 190 | irt = val & 0xffff; |
179 | case PIC_I2C_2_IRQ: | 191 | /* HW weirdness, I2C IRT entry has to be fixed up */ |
180 | irt = irt + 2; break; | 192 | switch (irq) { |
181 | case PIC_I2C_3_IRQ: | 193 | case PIC_I2C_1_IRQ: |
182 | irt = irt + 3; break; | 194 | irt = irt + 1; break; |
195 | case PIC_I2C_2_IRQ: | ||
196 | irt = irt + 2; break; | ||
197 | case PIC_I2C_3_IRQ: | ||
198 | irt = irt + 3; break; | ||
199 | } | ||
183 | } | 200 | } |
184 | } else if (irq >= PIC_PCIE_LINK_LEGACY_IRQ(0) && | 201 | } else if (irq >= PIC_PCIE_LINK_LEGACY_IRQ(0) && |
185 | irq <= PIC_PCIE_LINK_LEGACY_IRQ(3)) { | 202 | irq <= PIC_PCIE_LINK_LEGACY_IRQ(3)) { |
@@ -325,7 +342,7 @@ static unsigned int nlm_xlp2_get_pic_frequency(int node) | |||
325 | /* Find the clock source PLL device for PIC */ | 342 | /* Find the clock source PLL device for PIC */ |
326 | if (cpu_xlp9xx) { | 343 | if (cpu_xlp9xx) { |
327 | reg_select = nlm_read_sys_reg(clockbase, | 344 | reg_select = nlm_read_sys_reg(clockbase, |
328 | SYS_9XX_CLK_DEV_SEL) & 0x3; | 345 | SYS_9XX_CLK_DEV_SEL_REG) & 0x3; |
329 | switch (reg_select) { | 346 | switch (reg_select) { |
330 | case 0: | 347 | case 0: |
331 | ctrl_val0 = nlm_read_sys_reg(clockbase, | 348 | ctrl_val0 = nlm_read_sys_reg(clockbase, |
@@ -354,7 +371,7 @@ static unsigned int nlm_xlp2_get_pic_frequency(int node) | |||
354 | } | 371 | } |
355 | } else { | 372 | } else { |
356 | reg_select = (nlm_read_sys_reg(sysbase, | 373 | reg_select = (nlm_read_sys_reg(sysbase, |
357 | SYS_CLK_DEV_SEL) >> 22) & 0x3; | 374 | SYS_CLK_DEV_SEL_REG) >> 22) & 0x3; |
358 | switch (reg_select) { | 375 | switch (reg_select) { |
359 | case 0: | 376 | case 0: |
360 | ctrl_val0 = nlm_read_sys_reg(sysbase, | 377 | ctrl_val0 = nlm_read_sys_reg(sysbase, |
@@ -410,7 +427,7 @@ static unsigned int nlm_xlp2_get_pic_frequency(int node) | |||
410 | 427 | ||
411 | fdiv = fdiv/(1 << 13); | 428 | fdiv = fdiv/(1 << 13); |
412 | pll_out_freq_num = ((ref_clk >> 1) * (6 + mdiv)) + fdiv; | 429 | pll_out_freq_num = ((ref_clk >> 1) * (6 + mdiv)) + fdiv; |
413 | pll_out_freq_den = (1 << vco_post_div) * pll_post_div * 3; | 430 | pll_out_freq_den = (1 << vco_post_div) * pll_post_div * ref_div; |
414 | 431 | ||
415 | if (pll_out_freq_den > 0) | 432 | if (pll_out_freq_den > 0) |
416 | do_div(pll_out_freq_num, pll_out_freq_den); | 433 | do_div(pll_out_freq_num, pll_out_freq_den); |
@@ -418,10 +435,10 @@ static unsigned int nlm_xlp2_get_pic_frequency(int node) | |||
418 | /* PIC post divider, which happens after PLL */ | 435 | /* PIC post divider, which happens after PLL */ |
419 | if (cpu_xlp9xx) | 436 | if (cpu_xlp9xx) |
420 | pic_div = nlm_read_sys_reg(clockbase, | 437 | pic_div = nlm_read_sys_reg(clockbase, |
421 | SYS_9XX_CLK_DEV_DIV) & 0x3; | 438 | SYS_9XX_CLK_DEV_DIV_REG) & 0x3; |
422 | else | 439 | else |
423 | pic_div = (nlm_read_sys_reg(sysbase, | 440 | pic_div = (nlm_read_sys_reg(sysbase, |
424 | SYS_CLK_DEV_DIV) >> 22) & 0x3; | 441 | SYS_CLK_DEV_DIV_REG) >> 22) & 0x3; |
425 | do_div(pll_out_freq_num, 1 << pic_div); | 442 | do_div(pll_out_freq_num, 1 << pic_div); |
426 | 443 | ||
427 | return pll_out_freq_num; | 444 | return pll_out_freq_num; |
@@ -442,19 +459,21 @@ unsigned int nlm_get_cpu_frequency(void) | |||
442 | 459 | ||
443 | /* | 460 | /* |
444 | * Fills upto 8 pairs of entries containing the DRAM map of a node | 461 | * Fills upto 8 pairs of entries containing the DRAM map of a node |
445 | * if n < 0, get dram map for all nodes | 462 | * if node < 0, get dram map for all nodes |
446 | */ | 463 | */ |
447 | int xlp_get_dram_map(int n, uint64_t *dram_map) | 464 | int nlm_get_dram_map(int node, uint64_t *dram_map, int nentries) |
448 | { | 465 | { |
449 | uint64_t bridgebase, base, lim; | 466 | uint64_t bridgebase, base, lim; |
450 | uint32_t val; | 467 | uint32_t val; |
451 | unsigned int barreg, limreg, xlatreg; | 468 | unsigned int barreg, limreg, xlatreg; |
452 | int i, node, rv; | 469 | int i, n, rv; |
453 | 470 | ||
454 | /* Look only at mapping on Node 0, we don't handle crazy configs */ | 471 | /* Look only at mapping on Node 0, we don't handle crazy configs */ |
455 | bridgebase = nlm_get_bridge_regbase(0); | 472 | bridgebase = nlm_get_bridge_regbase(0); |
456 | rv = 0; | 473 | rv = 0; |
457 | for (i = 0; i < 8; i++) { | 474 | for (i = 0; i < 8; i++) { |
475 | if (rv + 1 >= nentries) | ||
476 | break; | ||
458 | if (cpu_is_xlp9xx()) { | 477 | if (cpu_is_xlp9xx()) { |
459 | barreg = BRIDGE_9XX_DRAM_BAR(i); | 478 | barreg = BRIDGE_9XX_DRAM_BAR(i); |
460 | limreg = BRIDGE_9XX_DRAM_LIMIT(i); | 479 | limreg = BRIDGE_9XX_DRAM_LIMIT(i); |
@@ -464,10 +483,10 @@ int xlp_get_dram_map(int n, uint64_t *dram_map) | |||
464 | limreg = BRIDGE_DRAM_LIMIT(i); | 483 | limreg = BRIDGE_DRAM_LIMIT(i); |
465 | xlatreg = BRIDGE_DRAM_NODE_TRANSLN(i); | 484 | xlatreg = BRIDGE_DRAM_NODE_TRANSLN(i); |
466 | } | 485 | } |
467 | if (n >= 0) { | 486 | if (node >= 0) { |
468 | /* node specified, get node mapping of BAR */ | 487 | /* node specified, get node mapping of BAR */ |
469 | val = nlm_read_bridge_reg(bridgebase, xlatreg); | 488 | val = nlm_read_bridge_reg(bridgebase, xlatreg); |
470 | node = (val >> 1) & 0x3; | 489 | n = (val >> 1) & 0x3; |
471 | if (n != node) | 490 | if (n != node) |
472 | continue; | 491 | continue; |
473 | } | 492 | } |
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c index 4fdd9fd29d1d..f743fd9da323 100644 --- a/arch/mips/netlogic/xlp/setup.c +++ b/arch/mips/netlogic/xlp/setup.c | |||
@@ -51,7 +51,6 @@ uint64_t nlm_io_base; | |||
51 | struct nlm_soc_info nlm_nodes[NLM_NR_NODES]; | 51 | struct nlm_soc_info nlm_nodes[NLM_NR_NODES]; |
52 | cpumask_t nlm_cpumask = CPU_MASK_CPU0; | 52 | cpumask_t nlm_cpumask = CPU_MASK_CPU0; |
53 | unsigned int nlm_threads_per_core; | 53 | unsigned int nlm_threads_per_core; |
54 | unsigned int xlp_cores_per_node; | ||
55 | 54 | ||
56 | static void nlm_linux_exit(void) | 55 | static void nlm_linux_exit(void) |
57 | { | 56 | { |
@@ -82,7 +81,7 @@ static void __init xlp_init_mem_from_bars(void) | |||
82 | uint64_t map[16]; | 81 | uint64_t map[16]; |
83 | int i, n; | 82 | int i, n; |
84 | 83 | ||
85 | n = xlp_get_dram_map(-1, map); /* -1: info for all nodes */ | 84 | n = nlm_get_dram_map(-1, map, ARRAY_SIZE(map)); /* -1 : all nodes */ |
86 | for (i = 0; i < n; i += 2) { | 85 | for (i = 0; i < n; i += 2) { |
87 | /* exclude 0x1000_0000-0x2000_0000, u-boot device */ | 86 | /* exclude 0x1000_0000-0x2000_0000, u-boot device */ |
88 | if (map[i] <= 0x10000000 && map[i+1] > 0x10000000) | 87 | if (map[i] <= 0x10000000 && map[i+1] > 0x10000000) |
@@ -163,10 +162,6 @@ void __init prom_init(void) | |||
163 | void *reset_vec; | 162 | void *reset_vec; |
164 | 163 | ||
165 | nlm_io_base = CKSEG1ADDR(XLP_DEFAULT_IO_BASE); | 164 | nlm_io_base = CKSEG1ADDR(XLP_DEFAULT_IO_BASE); |
166 | if (cpu_is_xlp9xx()) | ||
167 | xlp_cores_per_node = 32; | ||
168 | else | ||
169 | xlp_cores_per_node = 8; | ||
170 | nlm_init_boot_cpu(); | 165 | nlm_init_boot_cpu(); |
171 | xlp_mmu_init(); | 166 | xlp_mmu_init(); |
172 | nlm_node_init(0); | 167 | nlm_node_init(0); |
diff --git a/arch/mips/netlogic/xlp/usb-init-xlp2.c b/arch/mips/netlogic/xlp/usb-init-xlp2.c index 17ade1ce5dfd..2524939a5e3a 100644 --- a/arch/mips/netlogic/xlp/usb-init-xlp2.c +++ b/arch/mips/netlogic/xlp/usb-init-xlp2.c | |||
@@ -128,6 +128,9 @@ static void xlp9xx_usb_ack(struct irq_data *data) | |||
128 | case PIC_9XX_XHCI_1_IRQ: | 128 | case PIC_9XX_XHCI_1_IRQ: |
129 | port_addr = nlm_xlpii_get_usb_regbase(node, 2); | 129 | port_addr = nlm_xlpii_get_usb_regbase(node, 2); |
130 | break; | 130 | break; |
131 | case PIC_9XX_XHCI_2_IRQ: | ||
132 | port_addr = nlm_xlpii_get_usb_regbase(node, 3); | ||
133 | break; | ||
131 | default: | 134 | default: |
132 | pr_err("No matching USB irq %d node %d!\n", irq, node); | 135 | pr_err("No matching USB irq %d node %d!\n", irq, node); |
133 | return; | 136 | return; |
@@ -222,14 +225,16 @@ static int __init nlm_platform_xlpii_usb_init(void) | |||
222 | } | 225 | } |
223 | 226 | ||
224 | /* XLP 9XX, multi-node */ | 227 | /* XLP 9XX, multi-node */ |
225 | pr_info("Initializing 9XX USB Interface\n"); | 228 | pr_info("Initializing 9XX/5XX USB Interface\n"); |
226 | for (node = 0; node < NLM_NR_NODES; node++) { | 229 | for (node = 0; node < NLM_NR_NODES; node++) { |
227 | if (!nlm_node_present(node)) | 230 | if (!nlm_node_present(node)) |
228 | continue; | 231 | continue; |
229 | nlm_xlpii_usb_hw_reset(node, 1); | 232 | nlm_xlpii_usb_hw_reset(node, 1); |
230 | nlm_xlpii_usb_hw_reset(node, 2); | 233 | nlm_xlpii_usb_hw_reset(node, 2); |
234 | nlm_xlpii_usb_hw_reset(node, 3); | ||
231 | nlm_set_pic_extra_ack(node, PIC_9XX_XHCI_0_IRQ, xlp9xx_usb_ack); | 235 | nlm_set_pic_extra_ack(node, PIC_9XX_XHCI_0_IRQ, xlp9xx_usb_ack); |
232 | nlm_set_pic_extra_ack(node, PIC_9XX_XHCI_1_IRQ, xlp9xx_usb_ack); | 236 | nlm_set_pic_extra_ack(node, PIC_9XX_XHCI_1_IRQ, xlp9xx_usb_ack); |
237 | nlm_set_pic_extra_ack(node, PIC_9XX_XHCI_2_IRQ, xlp9xx_usb_ack); | ||
233 | } | 238 | } |
234 | return 0; | 239 | return 0; |
235 | } | 240 | } |
@@ -253,6 +258,9 @@ static void nlm_xlp9xx_usb_fixup_final(struct pci_dev *dev) | |||
253 | case 0x22: | 258 | case 0x22: |
254 | dev->irq = nlm_irq_to_xirq(node, PIC_9XX_XHCI_1_IRQ); | 259 | dev->irq = nlm_irq_to_xirq(node, PIC_9XX_XHCI_1_IRQ); |
255 | break; | 260 | break; |
261 | case 0x23: | ||
262 | dev->irq = nlm_irq_to_xirq(node, PIC_9XX_XHCI_2_IRQ); | ||
263 | break; | ||
256 | } | 264 | } |
257 | } | 265 | } |
258 | 266 | ||
diff --git a/arch/mips/netlogic/xlp/wakeup.c b/arch/mips/netlogic/xlp/wakeup.c index e5f44d2605a8..87d7846af2d0 100644 --- a/arch/mips/netlogic/xlp/wakeup.c +++ b/arch/mips/netlogic/xlp/wakeup.c | |||
@@ -99,7 +99,7 @@ static int wait_for_cpus(int cpu, int bootcpu) | |||
99 | do { | 99 | do { |
100 | notready = nlm_threads_per_core; | 100 | notready = nlm_threads_per_core; |
101 | for (i = 0; i < nlm_threads_per_core; i++) | 101 | for (i = 0; i < nlm_threads_per_core; i++) |
102 | if (cpu_ready[cpu + i] || cpu == bootcpu) | 102 | if (cpu_ready[cpu + i] || (cpu + i) == bootcpu) |
103 | --notready; | 103 | --notready; |
104 | } while (notready != 0 && --count > 0); | 104 | } while (notready != 0 && --count > 0); |
105 | 105 | ||
@@ -111,7 +111,7 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask) | |||
111 | struct nlm_soc_info *nodep; | 111 | struct nlm_soc_info *nodep; |
112 | uint64_t syspcibase, fusebase; | 112 | uint64_t syspcibase, fusebase; |
113 | uint32_t syscoremask, mask, fusemask; | 113 | uint32_t syscoremask, mask, fusemask; |
114 | int core, n, cpu; | 114 | int core, n, cpu, ncores; |
115 | 115 | ||
116 | for (n = 0; n < NLM_NR_NODES; n++) { | 116 | for (n = 0; n < NLM_NR_NODES; n++) { |
117 | if (n != 0) { | 117 | if (n != 0) { |
@@ -168,7 +168,8 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask) | |||
168 | syscoremask = (1 << hweight32(~fusemask & mask)) - 1; | 168 | syscoremask = (1 << hweight32(~fusemask & mask)) - 1; |
169 | 169 | ||
170 | pr_info("Node %d - SYS/FUSE coremask %x\n", n, syscoremask); | 170 | pr_info("Node %d - SYS/FUSE coremask %x\n", n, syscoremask); |
171 | for (core = 0; core < nlm_cores_per_node(); core++) { | 171 | ncores = nlm_cores_per_node(); |
172 | for (core = 0; core < ncores; core++) { | ||
172 | /* we will be on node 0 core 0 */ | 173 | /* we will be on node 0 core 0 */ |
173 | if (n == 0 && core == 0) | 174 | if (n == 0 && core == 0) |
174 | continue; | 175 | continue; |
@@ -178,8 +179,7 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask) | |||
178 | continue; | 179 | continue; |
179 | 180 | ||
180 | /* see if at least the first hw thread is enabled */ | 181 | /* see if at least the first hw thread is enabled */ |
181 | cpu = (n * nlm_cores_per_node() + core) | 182 | cpu = (n * ncores + core) * NLM_THREADS_PER_CORE; |
182 | * NLM_THREADS_PER_CORE; | ||
183 | if (!cpumask_test_cpu(cpu, wakeup_mask)) | 183 | if (!cpumask_test_cpu(cpu, wakeup_mask)) |
184 | continue; | 184 | continue; |
185 | 185 | ||