Skip to content

Commit b72c052

Browse files
chrisdearmanralfbaechle
authored andcommitted
[MIPS] Malta: Fix for SOCitSC based Maltas
And an attempt to tidy up the core/controller differences. Signed-off-by: Chris Dearman <chris@mips.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent eedab66 commit b72c052

6 files changed

Lines changed: 87 additions & 64 deletions

File tree

‎arch/mips/mips-boards/generic/init.c‎

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ int *_prom_argv, *_prom_envp;
5757

5858
int init_debug = 0;
5959

60-
unsigned int mips_revision_corid;
60+
int mips_revision_corid;
61+
int mips_revision_sconid;
6162

6263
/* Bonito64 system controller register base. */
6364
unsigned long _pcictrl_bonito;
@@ -275,13 +276,38 @@ void __init prom_init(void)
275276
else
276277
mips_revision_corid = MIPS_REVISION_CORID_CORE_EMUL_MSC;
277278
}
278-
switch(mips_revision_corid) {
279+
280+
mips_revision_sconid = MIPS_REVISION_SCONID;
281+
if (mips_revision_sconid == MIPS_REVISION_SCON_OTHER) {
282+
switch (mips_revision_corid) {
283+
case MIPS_REVISION_CORID_QED_RM5261:
284+
case MIPS_REVISION_CORID_CORE_LV:
285+
case MIPS_REVISION_CORID_CORE_FPGA:
286+
case MIPS_REVISION_CORID_CORE_FPGAR2:
287+
mips_revision_sconid = MIPS_REVISION_SCON_GT64120;
288+
break;
289+
case MIPS_REVISION_CORID_CORE_EMUL_BON:
290+
case MIPS_REVISION_CORID_BONITO64:
291+
case MIPS_REVISION_CORID_CORE_20K:
292+
mips_revision_sconid = MIPS_REVISION_SCON_BONITO;
293+
break;
294+
case MIPS_REVISION_CORID_CORE_MSC:
295+
case MIPS_REVISION_CORID_CORE_FPGA2:
296+
case MIPS_REVISION_CORID_CORE_FPGA3:
297+
case MIPS_REVISION_CORID_CORE_24K:
298+
case MIPS_REVISION_CORID_CORE_EMUL_MSC:
299+
mips_revision_sconid = MIPS_REVISION_SCON_SOCIT;
300+
break;
301+
default:
302+
mips_display_message("CC Error");
303+
while (1); /* We die here... */
304+
}
305+
}
306+
307+
switch (mips_revision_sconid) {
279308
u32 start, map, mask, data;
280309

281-
case MIPS_REVISION_CORID_QED_RM5261:
282-
case MIPS_REVISION_CORID_CORE_LV:
283-
case MIPS_REVISION_CORID_CORE_FPGA:
284-
case MIPS_REVISION_CORID_CORE_FPGAR2:
310+
case MIPS_REVISION_SCON_GT64120:
285311
/*
286312
* Setup the North bridge to do Master byte-lane swapping
287313
* when running in bigendian.
@@ -305,9 +331,7 @@ void __init prom_init(void)
305331
set_io_port_base(MALTA_GT_PORT_BASE);
306332
break;
307333

308-
case MIPS_REVISION_CORID_CORE_EMUL_BON:
309-
case MIPS_REVISION_CORID_BONITO64:
310-
case MIPS_REVISION_CORID_CORE_20K:
334+
case MIPS_REVISION_SCON_BONITO:
311335
_pcictrl_bonito_pcicfg = (unsigned long)ioremap(BONITO_PCICFG_BASE, BONITO_PCICFG_SIZE);
312336

313337
/*
@@ -334,13 +358,10 @@ void __init prom_init(void)
334358
set_io_port_base(MALTA_BONITO_PORT_BASE);
335359
break;
336360

337-
case MIPS_REVISION_CORID_CORE_MSC:
338-
case MIPS_REVISION_CORID_CORE_FPGA2:
339-
case MIPS_REVISION_CORID_CORE_FPGA3:
340-
case MIPS_REVISION_CORID_CORE_24K:
341-
case MIPS_REVISION_CORID_CORE_EMUL_MSC:
361+
case MIPS_REVISION_SCON_SOCIT:
362+
case MIPS_REVISION_SCON_ROCIT:
342363
_pcictrl_msc = (unsigned long)ioremap(MIPS_MSC01_PCI_REG_BASE, 0x2000);
343-
364+
mips_pci_controller:
344365
mb();
345366
MSC_READ(MSC01_PCI_CFG, data);
346367
MSC_WRITE(MSC01_PCI_CFG, data & ~MSC01_PCI_CFG_EN_BIT);
@@ -374,10 +395,15 @@ void __init prom_init(void)
374395
set_io_port_base(MALTA_MSC_PORT_BASE);
375396
break;
376397

398+
case MIPS_REVISION_SCON_SOCITSC:
399+
case MIPS_REVISION_SCON_SOCITSCP:
400+
_pcictrl_msc = (unsigned long)ioremap(MIPS_SOCITSC_PCI_REG_BASE, 0x2000);
401+
goto mips_pci_controller;
402+
377403
default:
378-
/* Unknown Core card */
379-
mips_display_message("CC Error");
380-
while(1); /* We die here... */
404+
/* Unknown system controller */
405+
mips_display_message("SC Error");
406+
while (1); /* We die here... */
381407
}
382408
#endif
383409
board_nmi_handler_setup = mips_nmi_setup;

‎arch/mips/mips-boards/generic/pci.c‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,8 @@ void __init mips_pcibios_init(void)
9292
struct pci_controller *controller;
9393
resource_size_t start, end, map, start1, end1, map1, map2, map3, mask;
9494

95-
switch (mips_revision_corid) {
96-
case MIPS_REVISION_CORID_QED_RM5261:
97-
case MIPS_REVISION_CORID_CORE_LV:
98-
case MIPS_REVISION_CORID_CORE_FPGA:
99-
case MIPS_REVISION_CORID_CORE_FPGAR2:
95+
switch (mips_revision_sconid) {
96+
case MIPS_REVISION_SCON_GT64120:
10097
/*
10198
* Due to a bug in the Galileo system controller, we need
10299
* to setup the PCI BAR for the Galileo internal registers.
@@ -161,9 +158,7 @@ void __init mips_pcibios_init(void)
161158
controller = &gt64120_controller;
162159
break;
163160

164-
case MIPS_REVISION_CORID_BONITO64:
165-
case MIPS_REVISION_CORID_CORE_20K:
166-
case MIPS_REVISION_CORID_CORE_EMUL_BON:
161+
case MIPS_REVISION_SCON_BONITO:
167162
/* Set up resource ranges from the controller's registers. */
168163
map = BONITO_PCIMAP;
169164
map1 = (BONITO_PCIMAP & BONITO_PCIMAP_PCIMAP_LO0) >>
@@ -195,11 +190,10 @@ void __init mips_pcibios_init(void)
195190
controller = &bonito64_controller;
196191
break;
197192

198-
case MIPS_REVISION_CORID_CORE_MSC:
199-
case MIPS_REVISION_CORID_CORE_FPGA2:
200-
case MIPS_REVISION_CORID_CORE_FPGA3:
201-
case MIPS_REVISION_CORID_CORE_24K:
202-
case MIPS_REVISION_CORID_CORE_EMUL_MSC:
193+
case MIPS_REVISION_SCON_SOCIT:
194+
case MIPS_REVISION_SCON_ROCIT:
195+
case MIPS_REVISION_SCON_SOCITSC:
196+
case MIPS_REVISION_SCON_SOCITSCP:
203197
/* Set up resource ranges from the controller's registers. */
204198
MSC_READ(MSC01_PCI_SC2PMBASL, start);
205199
MSC_READ(MSC01_PCI_SC2PMMSKL, mask);

‎arch/mips/mips-boards/malta/malta_int.c‎

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,19 @@ static inline int mips_pcibios_iack(void)
5353
* Determine highest priority pending interrupt by performing
5454
* a PCI Interrupt Acknowledge cycle.
5555
*/
56-
switch(mips_revision_corid) {
57-
case MIPS_REVISION_CORID_CORE_MSC:
58-
case MIPS_REVISION_CORID_CORE_FPGA2:
59-
case MIPS_REVISION_CORID_CORE_FPGA3:
60-
case MIPS_REVISION_CORID_CORE_24K:
61-
case MIPS_REVISION_CORID_CORE_EMUL_MSC:
56+
switch (mips_revision_sconid) {
57+
case MIPS_REVISION_SCON_SOCIT:
58+
case MIPS_REVISION_SCON_ROCIT:
59+
case MIPS_REVISION_SCON_SOCITSC:
60+
case MIPS_REVISION_SCON_SOCITSCP:
6261
MSC_READ(MSC01_PCI_IACK, irq);
6362
irq &= 0xff;
6463
break;
65-
case MIPS_REVISION_CORID_QED_RM5261:
66-
case MIPS_REVISION_CORID_CORE_LV:
67-
case MIPS_REVISION_CORID_CORE_FPGA:
68-
case MIPS_REVISION_CORID_CORE_FPGAR2:
64+
case MIPS_REVISION_SCON_GT64120:
6965
irq = GT_READ(GT_PCI0_IACK_OFS);
7066
irq &= 0xff;
7167
break;
72-
case MIPS_REVISION_CORID_BONITO64:
73-
case MIPS_REVISION_CORID_CORE_20K:
74-
case MIPS_REVISION_CORID_CORE_EMUL_BON:
68+
case MIPS_REVISION_SCON_BONITO:
7569
/* The following will generate a PCI IACK cycle on the
7670
* Bonito controller. It's a little bit kludgy, but it
7771
* was the easiest way to implement it in hardware at
@@ -89,7 +83,7 @@ static inline int mips_pcibios_iack(void)
8983
BONITO_PCIMAP_CFG = 0;
9084
break;
9185
default:
92-
printk("Unknown Core card, don't know the system controller.\n");
86+
printk("Unknown system controller.\n");
9387
return -1;
9488
}
9589
return irq;
@@ -144,27 +138,21 @@ static void corehi_irqdispatch(void)
144138
Do it for the others too.
145139
*/
146140

147-
switch(mips_revision_corid) {
148-
case MIPS_REVISION_CORID_CORE_MSC:
149-
case MIPS_REVISION_CORID_CORE_FPGA2:
150-
case MIPS_REVISION_CORID_CORE_FPGA3:
151-
case MIPS_REVISION_CORID_CORE_24K:
152-
case MIPS_REVISION_CORID_CORE_EMUL_MSC:
141+
switch (mips_revision_sconid) {
142+
case MIPS_REVISION_SCON_SOCIT:
143+
case MIPS_REVISION_SCON_ROCIT:
144+
case MIPS_REVISION_SCON_SOCITSC:
145+
case MIPS_REVISION_SCON_SOCITSCP:
153146
ll_msc_irq();
154147
break;
155-
case MIPS_REVISION_CORID_QED_RM5261:
156-
case MIPS_REVISION_CORID_CORE_LV:
157-
case MIPS_REVISION_CORID_CORE_FPGA:
158-
case MIPS_REVISION_CORID_CORE_FPGAR2:
148+
case MIPS_REVISION_SCON_GT64120:
159149
intrcause = GT_READ(GT_INTRCAUSE_OFS);
160150
datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
161151
datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
162152
printk("GT_INTRCAUSE = %08x\n", intrcause);
163153
printk("GT_CPUERR_ADDR = %02x%08x\n", datahi, datalo);
164154
break;
165-
case MIPS_REVISION_CORID_BONITO64:
166-
case MIPS_REVISION_CORID_CORE_20K:
167-
case MIPS_REVISION_CORID_CORE_EMUL_BON:
155+
case MIPS_REVISION_SCON_BONITO:
168156
pcibadaddr = BONITO_PCIBADADDR;
169157
pcimstat = BONITO_PCIMSTAT;
170158
intisr = BONITO_INTISR;

‎arch/mips/mips-boards/malta/malta_setup.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ void __init plat_mem_setup(void)
103103
kgdb_config ();
104104
#endif
105105

106-
if ((mips_revision_corid == MIPS_REVISION_CORID_BONITO64) ||
107-
(mips_revision_corid == MIPS_REVISION_CORID_CORE_20K) ||
108-
(mips_revision_corid == MIPS_REVISION_CORID_CORE_EMUL_BON)) {
106+
if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
109107
char *argptr;
110108

111109
argptr = prom_getcmdline();

‎include/asm-mips/mips-boards/generic.h‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,28 @@
7373
* CoreEMUL with Bonito System Controller is treated like a Core20K
7474
* CoreEMUL with SOC-it 101 System Controller is treated like a CoreMSC
7575
*/
76-
#define MIPS_REVISION_CORID_CORE_EMUL_BON 0x63
77-
#define MIPS_REVISION_CORID_CORE_EMUL_MSC 0x65
76+
#define MIPS_REVISION_CORID_CORE_EMUL_BON -1
77+
#define MIPS_REVISION_CORID_CORE_EMUL_MSC -2
7878

7979
#define MIPS_REVISION_CORID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 10) & 0x3f)
8080

81-
extern unsigned int mips_revision_corid;
81+
extern int mips_revision_corid;
82+
83+
#define MIPS_REVISION_SCON_OTHER 0
84+
#define MIPS_REVISION_SCON_SOCITSC 1
85+
#define MIPS_REVISION_SCON_SOCITSCP 2
86+
87+
/* Artificial SCON defines for MIPS_REVISION_SCON_OTHER */
88+
#define MIPS_REVISION_SCON_UNKNOWN -1
89+
#define MIPS_REVISION_SCON_GT64120 -2
90+
#define MIPS_REVISION_SCON_BONITO -3
91+
#define MIPS_REVISION_SCON_BRTL -4
92+
#define MIPS_REVISION_SCON_SOCIT -5
93+
#define MIPS_REVISION_SCON_ROCIT -6
94+
95+
#define MIPS_REVISION_SCONID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 24) & 0xff)
96+
97+
extern int mips_revision_sconid;
8298

8399
#ifdef CONFIG_PCI
84100
extern void mips_pcibios_init(void);

‎include/asm-mips/mips-boards/msc01_pci.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
* latter, they should be moved elsewhere.
209209
*/
210210
#define MIPS_MSC01_PCI_REG_BASE 0x1bd00000
211+
#define MIPS_SOCITSC_PCI_REG_BASE 0x1ff10000
211212

212213
extern unsigned long _pcictrl_msc;
213214

0 commit comments

Comments
 (0)