Skip to content

Commit 9267a30

Browse files
Marc St-Jeanralfbaechle
authored andcommitted
[MIPS] PMC MSP71xx mips common
Patch to add mips common support for the PMC-Sierra MSP71xx devices. Signed-off-by: Marc St-Jean <Marc_St-Jean@pmc-sierra.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 35832e2 commit 9267a30

10 files changed

Lines changed: 179 additions & 2 deletions

File tree

‎arch/mips/Kconfig‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ config MIPS_SIM
250250
select DMA_NONCOHERENT
251251
select SYS_HAS_EARLY_PRINTK
252252
select IRQ_CPU
253+
select BOOT_RAW
253254
select SYS_HAS_CPU_MIPS32_R1
254255
select SYS_HAS_CPU_MIPS32_R2
255256
select SYS_HAS_EARLY_PRINTK
@@ -333,6 +334,27 @@ config MACH_VR41XX
333334
select SYS_HAS_CPU_VR41XX
334335
select GENERIC_HARDIRQS_NO__DO_IRQ
335336

337+
config PMC_MSP
338+
bool "PMC-Sierra MSP chipsets"
339+
depends on EXPERIMENTAL
340+
select DMA_NONCOHERENT
341+
select SWAP_IO_SPACE
342+
select NO_EXCEPT_FILL
343+
select BOOT_RAW
344+
select SYS_HAS_CPU_MIPS32_R1
345+
select SYS_HAS_CPU_MIPS32_R2
346+
select SYS_SUPPORTS_32BIT_KERNEL
347+
select SYS_SUPPORTS_BIG_ENDIAN
348+
select SYS_SUPPORTS_KGDB
349+
select IRQ_CPU
350+
select SERIAL_8250
351+
select SERIAL_8250_CONSOLE
352+
help
353+
This adds support for the PMC-Sierra family of Multi-Service
354+
Processor System-On-A-Chips. These parts include a number
355+
of integrated peripherals, interfaces and DSPs in addition to
356+
a variety of MIPS cores.
357+
336358
config PMC_YOSEMITE
337359
bool "PMC-Sierra Yosemite eval board"
338360
select DMA_COHERENT
@@ -706,6 +728,9 @@ config ARC
706728
config ARCH_MAY_HAVE_PC_FDC
707729
bool
708730

731+
config BOOT_RAW
732+
bool
733+
709734
config DMA_COHERENT
710735
bool
711736

@@ -812,6 +837,12 @@ config IRQ_CPU_RM7K
812837
config IRQ_CPU_RM9K
813838
bool
814839

840+
config IRQ_MSP_SLP
841+
bool
842+
843+
config IRQ_MSP_CIC
844+
bool
845+
815846
config IRQ_MV64340
816847
bool
817848

@@ -825,6 +856,9 @@ config MIPS_BOARDS_GEN
825856
config PCI_GT64XXX_PCI0
826857
bool
827858

859+
config NO_EXCEPT_FILL
860+
bool
861+
828862
config MIPS_TX3927
829863
bool
830864
select HAS_TXX9_SERIAL
@@ -886,6 +920,7 @@ config MIPS_L1_CACHE_SHIFT
886920
int
887921
default "4" if MACH_DECSTATION || SNI_RM
888922
default "7" if SGI_IP27
923+
default "4" if PMC_MSP4200_EVAL
889924
default "5"
890925

891926
config HAVE_STD_PC_SERIAL_PORT

‎arch/mips/Makefile‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,14 @@ core-$(CONFIG_MOMENCO_OCELOT) += arch/mips/gt64120/common/ \
342342
cflags-$(CONFIG_MOMENCO_OCELOT) += -Iinclude/asm-mips/mach-ocelot
343343
load-$(CONFIG_MOMENCO_OCELOT) += 0xffffffff80100000
344344

345+
#
346+
# PMC-Sierra MSP SOCs
347+
#
348+
core-$(CONFIG_PMC_MSP) += arch/mips/pmc-sierra/msp71xx/
349+
cflags-$(CONFIG_PMC_MSP) += -Iinclude/asm-mips/pmc-sierra/msp71xx \
350+
-mno-branch-likely
351+
load-$(CONFIG_PMC_MSP) += 0xffffffff80100000
352+
345353
#
346354
# PMC-Sierra Yosemite
347355
#
@@ -595,7 +603,8 @@ JIFFIES = jiffies_64
595603
endif
596604

597605
AFLAGS += $(cflags-y)
598-
CFLAGS += $(cflags-y)
606+
CFLAGS += $(cflags-y) \
607+
-D"VMLINUX_LOAD_ADDRESS=$(load-y)"
599608

600609
LDFLAGS += -m $(ld-emul)
601610

‎arch/mips/kernel/cpu-probe.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,29 @@ static inline void check_wait(void)
186186
}
187187
}
188188

189+
static inline void check_errata(void)
190+
{
191+
struct cpuinfo_mips *c = &current_cpu_data;
192+
193+
switch (c->cputype) {
194+
case CPU_34K:
195+
/*
196+
* Erratum "RPS May Cause Incorrect Instruction Execution"
197+
* This code only handles VPE0, any SMP/SMTC/RTOS code
198+
* making use of VPE1 will be responsable for that VPE.
199+
*/
200+
if ((c->processor_id & PRID_REV_MASK) <= PRID_REV_34K_V1_0_2)
201+
write_c0_config7(read_c0_config7() | MIPS_CONF7_RPS);
202+
break;
203+
default:
204+
break;
205+
}
206+
}
207+
189208
void __init check_bugs32(void)
190209
{
191210
check_wait();
211+
check_errata();
192212
}
193213

194214
/*

‎arch/mips/kernel/head.S‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/init.h>
1717
#include <linux/threads.h>
1818

19+
#include <asm/addrspace.h>
1920
#include <asm/asm.h>
2021
#include <asm/asmmacro.h>
2122
#include <asm/irqflags.h>
@@ -129,16 +130,18 @@
129130
#endif
130131
.endm
131132

133+
#ifndef CONFIG_NO_EXCEPT_FILL
132134
/*
133135
* Reserved space for exception handlers.
134136
* Necessary for machines which link their kernels at KSEG0.
135137
*/
136138
.fill 0x400
139+
#endif
137140

138141
EXPORT(stext) # used for profiling
139142
EXPORT(_stext)
140143

141-
#ifndef CONFIG_MIPS_SIM
144+
#ifdef CONFIG_BOOT_RAW
142145
/*
143146
* Give us a fighting chance of running if execution beings at the
144147
* kernel load address. This is needed because this platform does

‎arch/mips/kernel/traps.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ extern asmlinkage void handle_reserved(void);
6969
extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
7070
struct mips_fpu_struct *ctx, int has_fpu);
7171

72+
void (*board_watchpoint_handler)(struct pt_regs *regs);
7273
void (*board_be_init)(void);
7374
int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
7475
void (*board_nmi_handler_setup)(void);
@@ -833,6 +834,11 @@ asmlinkage void do_mdmx(struct pt_regs *regs)
833834

834835
asmlinkage void do_watch(struct pt_regs *regs)
835836
{
837+
if (board_watchpoint_handler) {
838+
(*board_watchpoint_handler)(regs);
839+
return;
840+
}
841+
836842
/*
837843
* We use the watch exception where available to detect stack
838844
* overflows.

‎arch/mips/pmc-sierra/Kconfig‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
1+
choice
2+
prompt "PMC-Sierra MSP SOC type"
3+
depends on PMC_MSP
4+
5+
config PMC_MSP4200_EVAL
6+
bool "PMC-Sierra MSP4200 Eval Board"
7+
select IRQ_MSP_SLP
8+
select HW_HAS_PCI
9+
10+
config PMC_MSP4200_GW
11+
bool "PMC-Sierra MSP4200 VoIP Gateway"
12+
select IRQ_MSP_SLP
13+
select HW_HAS_PCI
14+
15+
config PMC_MSP7120_EVAL
16+
bool "PMC-Sierra MSP7120 Eval Board"
17+
select SYS_SUPPORTS_MULTITHREADING
18+
select IRQ_MSP_CIC
19+
select HW_HAS_PCI
20+
21+
config PMC_MSP7120_GW
22+
bool "PMC-Sierra MSP7120 Residential Gateway"
23+
select SYS_SUPPORTS_MULTITHREADING
24+
select IRQ_MSP_CIC
25+
select HW_HAS_PCI
26+
27+
config PMC_MSP7120_FPGA
28+
bool "PMC-Sierra MSP7120 FPGA"
29+
select SYS_SUPPORTS_MULTITHREADING
30+
select IRQ_MSP_CIC
31+
select HW_HAS_PCI
32+
33+
endchoice
34+
35+
menu "Options for PMC-Sierra MSP chipsets"
36+
depends on PMC_MSP
37+
38+
config PMC_MSP_EMBEDDED_ROOTFS
39+
bool "Root filesystem embedded in kernel image"
40+
select MTD
41+
select MTD_BLOCK
42+
select MTD_PMC_MSP_RAMROOT
43+
select MTD_RAM
44+
45+
endmenu
46+
147
config HYPERTRANSPORT
248
bool "Hypertransport Support for PMC-Sierra Yosemite"
349
depends on PMC_YOSEMITE

‎include/asm-mips/bootinfo.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,18 @@
213213
#define MACH_GROUP_LEMOTE 27
214214
#define MACH_LEMOTE_FULONG 0
215215

216+
/*
217+
* Valid machtype for group PMC-MSP
218+
*/
219+
#define MACH_GROUP_MSP 26 /* PMC-Sierra MSP boards/CPUs */
220+
#define MACH_MSP4200_EVAL 0 /* PMC-Sierra MSP4200 Evaluation */
221+
#define MACH_MSP4200_GW 1 /* PMC-Sierra MSP4200 Gateway demo */
222+
#define MACH_MSP4200_FPGA 2 /* PMC-Sierra MSP4200 Emulation */
223+
#define MACH_MSP7120_EVAL 3 /* PMC-Sierra MSP7120 Evaluation */
224+
#define MACH_MSP7120_GW 4 /* PMC-Sierra MSP7120 Residential GW */
225+
#define MACH_MSP7120_FPGA 5 /* PMC-Sierra MSP7120 Emulation */
226+
#define MACH_MSP_OTHER 255 /* PMC-Sierra unknown board type */
227+
216228
#define CL_SIZE COMMAND_LINE_SIZE
217229

218230
const char *get_system_type(void);

‎include/asm-mips/cpu.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
* Definitions for 7:0 on legacy processors
110110
*/
111111

112+
#define PRID_REV_MASK 0x00ff
112113

113114
#define PRID_REV_TX4927 0x0022
114115
#define PRID_REV_TX4937 0x0030
@@ -125,6 +126,7 @@
125126
#define PRID_REV_VR4122 0x0070
126127
#define PRID_REV_VR4181A 0x0070 /* Same as VR4122 */
127128
#define PRID_REV_VR4130 0x0080
129+
#define PRID_REV_34K_V1_0_2 0x0022
128130

129131
/*
130132
* Older processors used to encode processor version and revision in two

‎include/asm-mips/mipsregs.h‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <linux/linkage.h>
1717
#include <asm/hazards.h>
18+
#include <asm/war.h>
1819

1920
/*
2021
* The following macros are especially useful for __asm__
@@ -537,6 +538,9 @@
537538

538539
#define MIPS_CONF7_WII (_ULCAST_(1) << 31)
539540

541+
#define MIPS_CONF7_RPS (_ULCAST_(1) << 2)
542+
543+
540544
/*
541545
* Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
542546
*/
@@ -1298,10 +1302,39 @@ static inline void tlb_probe(void)
12981302

12991303
static inline void tlb_read(void)
13001304
{
1305+
#if MIPS34K_MISSED_ITLB_WAR
1306+
int res = 0;
1307+
1308+
__asm__ __volatile__(
1309+
" .set push \n"
1310+
" .set noreorder \n"
1311+
" .set noat \n"
1312+
" .set mips32r2 \n"
1313+
" .word 0x41610001 # dvpe $1 \n"
1314+
" move %0, $1 \n"
1315+
" ehb \n"
1316+
" .set pop \n"
1317+
: "=r" (res));
1318+
1319+
instruction_hazard();
1320+
#endif
1321+
13011322
__asm__ __volatile__(
13021323
".set noreorder\n\t"
13031324
"tlbr\n\t"
13041325
".set reorder");
1326+
1327+
#if MIPS34K_MISSED_ITLB_WAR
1328+
if ((res & _ULCAST_(1)))
1329+
__asm__ __volatile__(
1330+
" .set push \n"
1331+
" .set noreorder \n"
1332+
" .set noat \n"
1333+
" .set mips32r2 \n"
1334+
" .word 0x41600021 # evpe \n"
1335+
" ehb \n"
1336+
" .set pop \n");
1337+
#endif
13051338
}
13061339

13071340
static inline void tlb_write_indexed(void)

‎include/asm-mips/war.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,14 @@
197197
#define R10000_LLSC_WAR 1
198198
#endif
199199

200+
/*
201+
* 34K core erratum: "Problems Executing the TLBR Instruction"
202+
*/
203+
#if defined(CONFIG_PMC_MSP7120_EVAL) || defined(CONFIG_PMC_MSP7120_GW) || \
204+
defined(CONFIG_PMC_MSP7120_FPGA)
205+
#define MIPS34K_MISSED_ITLB_WAR 1
206+
#endif
207+
200208
/*
201209
* Workarounds default to off
202210
*/
@@ -236,5 +244,8 @@
236244
#ifndef R10000_LLSC_WAR
237245
#define R10000_LLSC_WAR 0
238246
#endif
247+
#ifndef MIPS34K_MISSED_ITLB_WAR
248+
#define MIPS34K_MISSED_ITLB_WAR 0
249+
#endif
239250

240251
#endif /* _ASM_WAR_H */

0 commit comments

Comments
 (0)