diff options
author | Wu Zhangjin <wuzhangjin@gmail.com> | 2009-11-11 00:39:12 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-12-16 20:57:15 -0500 |
commit | 55045ff5557bc804752e84dca5d1b1f1d4bb4e31 (patch) | |
tree | 981f6201429b833afb801079aa6abf5e72dc4349 /arch | |
parent | 6e34358ed4f89556b5474ff883ac148750189ef0 (diff) |
MIPS: Loongson 2F: Cleanup the #if clauses
This patch adds two new kernel options: CPU_SUPPORTS_CPUFREQ and
CPU_SUPPORTS_ADDRWINCFG to describe the new features of Loongons 2F and
replaces the several ugly #if clauses by them.
These two options will be utilized by the future loongson revisions and
related drivers such as the coming Loongson 2F CPUFreq driver.
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/Kconfig | 6 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-loongson/loongson.h | 6 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-loongson/pci.h | 4 | ||||
-rw-r--r-- | arch/mips/loongson/common/init.c | 2 | ||||
-rw-r--r-- | arch/mips/loongson/common/mem.c | 8 | ||||
-rw-r--r-- | arch/mips/loongson/common/pci.c | 2 |
6 files changed, 17 insertions, 11 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index c2b4cd511419..51e4e5b02f9d 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1334,6 +1334,8 @@ config SYS_HAS_CPU_LOONGSON2E | |||
1334 | 1334 | ||
1335 | config SYS_HAS_CPU_LOONGSON2F | 1335 | config SYS_HAS_CPU_LOONGSON2F |
1336 | bool | 1336 | bool |
1337 | select CPU_SUPPORTS_CPUFREQ | ||
1338 | select CPU_SUPPORTS_ADDRWINCFG if 64BIT | ||
1337 | 1339 | ||
1338 | config SYS_HAS_CPU_MIPS32_R1 | 1340 | config SYS_HAS_CPU_MIPS32_R1 |
1339 | bool | 1341 | bool |
@@ -1443,6 +1445,10 @@ config CPU_SUPPORTS_32BIT_KERNEL | |||
1443 | bool | 1445 | bool |
1444 | config CPU_SUPPORTS_64BIT_KERNEL | 1446 | config CPU_SUPPORTS_64BIT_KERNEL |
1445 | bool | 1447 | bool |
1448 | config CPU_SUPPORTS_CPUFREQ | ||
1449 | bool | ||
1450 | config CPU_SUPPORTS_ADDRWINCFG | ||
1451 | bool | ||
1446 | config CPU_SUPPORTS_HUGEPAGES | 1452 | config CPU_SUPPORTS_HUGEPAGES |
1447 | bool | 1453 | bool |
1448 | config MIPS_PGD_C0_CONTEXT | 1454 | config MIPS_PGD_C0_CONTEXT |
diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h index 99113902719a..9bccdb5d4b51 100644 --- a/arch/mips/include/asm/mach-loongson/loongson.h +++ b/arch/mips/include/asm/mach-loongson/loongson.h | |||
@@ -227,7 +227,7 @@ extern void mach_irq_dispatch(unsigned int pending); | |||
227 | ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6)) | 227 | ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6)) |
228 | 228 | ||
229 | /* Chip Config */ | 229 | /* Chip Config */ |
230 | #ifdef CONFIG_CPU_LOONGSON2F | 230 | #ifdef CONFIG_CPU_SUPPORTS_CPUFREQ |
231 | #define LOONGSON_CHIPCFG0 LOONGSON_REG(LOONGSON_REGBASE + 0x80) | 231 | #define LOONGSON_CHIPCFG0 LOONGSON_REG(LOONGSON_REGBASE + 0x80) |
232 | #endif | 232 | #endif |
233 | 233 | ||
@@ -236,7 +236,7 @@ extern void mach_irq_dispatch(unsigned int pending); | |||
236 | * | 236 | * |
237 | * loongson2e do not have this module | 237 | * loongson2e do not have this module |
238 | */ | 238 | */ |
239 | #if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) | 239 | #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG |
240 | 240 | ||
241 | /* address window config module base address */ | 241 | /* address window config module base address */ |
242 | #define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul | 242 | #define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul |
@@ -306,6 +306,6 @@ extern unsigned long _loongson_addrwincfg_base; | |||
306 | #define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \ | 306 | #define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \ |
307 | LOONGSON_ADDRWIN_CFG(PCIDMA, DDR, win, src, dst, size) | 307 | LOONGSON_ADDRWIN_CFG(PCIDMA, DDR, win, src, dst, size) |
308 | 308 | ||
309 | #endif /* ! CONFIG_CPU_LOONGSON2F && CONFIG_64BIT */ | 309 | #endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */ |
310 | 310 | ||
311 | #endif /* __ASM_MACH_LOONGSON_LOONGSON_H */ | 311 | #endif /* __ASM_MACH_LOONGSON_LOONGSON_H */ |
diff --git a/arch/mips/include/asm/mach-loongson/pci.h b/arch/mips/include/asm/mach-loongson/pci.h index 31ba90891ec0..a199a4f6de4e 100644 --- a/arch/mips/include/asm/mach-loongson/pci.h +++ b/arch/mips/include/asm/mach-loongson/pci.h | |||
@@ -28,7 +28,7 @@ extern struct pci_ops loongson_pci_ops; | |||
28 | /* this is an offset from mips_io_port_base */ | 28 | /* this is an offset from mips_io_port_base */ |
29 | #define LOONGSON_PCI_IO_START 0x00004000UL | 29 | #define LOONGSON_PCI_IO_START 0x00004000UL |
30 | 30 | ||
31 | #if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) | 31 | #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * we use address window2 to map cpu address space to pci space | 34 | * we use address window2 to map cpu address space to pci space |
@@ -56,6 +56,6 @@ extern struct pci_ops loongson_pci_ops; | |||
56 | /* this is an offset from mips_io_port_base */ | 56 | /* this is an offset from mips_io_port_base */ |
57 | #define LOONGSON_PCI_IO_START 0x00004000UL | 57 | #define LOONGSON_PCI_IO_START 0x00004000UL |
58 | 58 | ||
59 | #endif /* !(defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT))*/ | 59 | #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */ |
60 | 60 | ||
61 | #endif /* !__ASM_MACH_LOONGSON_PCI_H_ */ | 61 | #endif /* !__ASM_MACH_LOONGSON_PCI_H_ */ |
diff --git a/arch/mips/loongson/common/init.c b/arch/mips/loongson/common/init.c index 743d3571f010..2b92a23d29dd 100644 --- a/arch/mips/loongson/common/init.c +++ b/arch/mips/loongson/common/init.c | |||
@@ -21,7 +21,7 @@ void __init prom_init(void) | |||
21 | set_io_port_base((unsigned long) | 21 | set_io_port_base((unsigned long) |
22 | ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE)); | 22 | ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE)); |
23 | 23 | ||
24 | #if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) | 24 | #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG |
25 | _loongson_addrwincfg_base = (unsigned long) | 25 | _loongson_addrwincfg_base = (unsigned long) |
26 | ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE); | 26 | ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE); |
27 | #endif | 27 | #endif |
diff --git a/arch/mips/loongson/common/mem.c b/arch/mips/loongson/common/mem.c index e93551dbc9ea..981e9190f393 100644 --- a/arch/mips/loongson/common/mem.c +++ b/arch/mips/loongson/common/mem.c | |||
@@ -20,8 +20,7 @@ void __init prom_init_memory(void) | |||
20 | 20 | ||
21 | add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize << | 21 | add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize << |
22 | 20), BOOT_MEM_RESERVED); | 22 | 20), BOOT_MEM_RESERVED); |
23 | #ifdef CONFIG_64BIT | 23 | #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG |
24 | #ifdef CONFIG_CPU_LOONGSON2F | ||
25 | { | 24 | { |
26 | int bit; | 25 | int bit; |
27 | 26 | ||
@@ -36,8 +35,9 @@ void __init prom_init_memory(void) | |||
36 | 0x80000000ul, (1 << bit)); | 35 | 0x80000000ul, (1 << bit)); |
37 | mmiowb(); | 36 | mmiowb(); |
38 | } | 37 | } |
39 | #endif /* CONFIG_CPU_LOONGSON2F */ | 38 | #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */ |
40 | 39 | ||
40 | #ifdef CONFIG_64BIT | ||
41 | if (highmemsize > 0) | 41 | if (highmemsize > 0) |
42 | add_memory_region(LOONGSON_HIGHMEM_START, | 42 | add_memory_region(LOONGSON_HIGHMEM_START, |
43 | highmemsize << 20, BOOT_MEM_RAM); | 43 | highmemsize << 20, BOOT_MEM_RAM); |
@@ -45,7 +45,7 @@ void __init prom_init_memory(void) | |||
45 | add_memory_region(LOONGSON_PCI_MEM_END + 1, LOONGSON_HIGHMEM_START - | 45 | add_memory_region(LOONGSON_PCI_MEM_END + 1, LOONGSON_HIGHMEM_START - |
46 | LOONGSON_PCI_MEM_END - 1, BOOT_MEM_RESERVED); | 46 | LOONGSON_PCI_MEM_END - 1, BOOT_MEM_RESERVED); |
47 | 47 | ||
48 | #endif /* CONFIG_64BIT */ | 48 | #endif /* !CONFIG_64BIT */ |
49 | } | 49 | } |
50 | 50 | ||
51 | /* override of arch/mips/mm/cache.c: __uncached_access */ | 51 | /* override of arch/mips/mm/cache.c: __uncached_access */ |
diff --git a/arch/mips/loongson/common/pci.c b/arch/mips/loongson/common/pci.c index eac43b8f695e..31d8c5ecd16c 100644 --- a/arch/mips/loongson/common/pci.c +++ b/arch/mips/loongson/common/pci.c | |||
@@ -68,7 +68,7 @@ static void __init setup_pcimap(void) | |||
68 | deassert for some broken device */ | 68 | deassert for some broken device */ |
69 | LOONGSON_PXARB_CFG = 0x00fe0105ul; | 69 | LOONGSON_PXARB_CFG = 0x00fe0105ul; |
70 | 70 | ||
71 | #if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) | 71 | #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG |
72 | /* | 72 | /* |
73 | * set cpu addr window2 to map CPU address space to PCI address space | 73 | * set cpu addr window2 to map CPU address space to PCI address space |
74 | */ | 74 | */ |