Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wu Zhangjin and committed by
Ralf Baechle
55045ff5 6e34358e

+17 -11
+6
arch/mips/Kconfig
··· 1334 1334 1335 1335 config SYS_HAS_CPU_LOONGSON2F 1336 1336 bool 1337 + select CPU_SUPPORTS_CPUFREQ 1338 + select CPU_SUPPORTS_ADDRWINCFG if 64BIT 1337 1339 1338 1340 config SYS_HAS_CPU_MIPS32_R1 1339 1341 bool ··· 1444 1442 config CPU_SUPPORTS_32BIT_KERNEL 1445 1443 bool 1446 1444 config CPU_SUPPORTS_64BIT_KERNEL 1445 + bool 1446 + config CPU_SUPPORTS_CPUFREQ 1447 + bool 1448 + config CPU_SUPPORTS_ADDRWINCFG 1447 1449 bool 1448 1450 config CPU_SUPPORTS_HUGEPAGES 1449 1451 bool
+3 -3
arch/mips/include/asm/mach-loongson/loongson.h
··· 227 227 ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6)) 228 228 229 229 /* Chip Config */ 230 - #ifdef CONFIG_CPU_LOONGSON2F 230 + #ifdef CONFIG_CPU_SUPPORTS_CPUFREQ 231 231 #define LOONGSON_CHIPCFG0 LOONGSON_REG(LOONGSON_REGBASE + 0x80) 232 232 #endif 233 233 ··· 236 236 * 237 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 241 /* address window config module base address */ 242 242 #define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul ··· 306 306 #define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \ 307 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 311 #endif /* __ASM_MACH_LOONGSON_LOONGSON_H */
+2 -2
arch/mips/include/asm/mach-loongson/pci.h
··· 28 28 /* this is an offset from mips_io_port_base */ 29 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 34 * we use address window2 to map cpu address space to pci space ··· 56 56 /* this is an offset from mips_io_port_base */ 57 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 61 #endif /* !__ASM_MACH_LOONGSON_PCI_H_ */
+1 -1
arch/mips/loongson/common/init.c
··· 21 21 set_io_port_base((unsigned long) 22 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 25 _loongson_addrwincfg_base = (unsigned long) 26 26 ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE); 27 27 #endif
+4 -4
arch/mips/loongson/common/mem.c
··· 20 20 21 21 add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize << 22 22 20), BOOT_MEM_RESERVED); 23 - #ifdef CONFIG_64BIT 24 - #ifdef CONFIG_CPU_LOONGSON2F 23 + #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG 25 24 { 26 25 int bit; 27 26 ··· 35 36 0x80000000ul, (1 << bit)); 36 37 mmiowb(); 37 38 } 38 - #endif /* CONFIG_CPU_LOONGSON2F */ 39 + #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */ 39 40 41 + #ifdef CONFIG_64BIT 40 42 if (highmemsize > 0) 41 43 add_memory_region(LOONGSON_HIGHMEM_START, 42 44 highmemsize << 20, BOOT_MEM_RAM); ··· 45 45 add_memory_region(LOONGSON_PCI_MEM_END + 1, LOONGSON_HIGHMEM_START - 46 46 LOONGSON_PCI_MEM_END - 1, BOOT_MEM_RESERVED); 47 47 48 - #endif /* CONFIG_64BIT */ 48 + #endif /* !CONFIG_64BIT */ 49 49 } 50 50 51 51 /* override of arch/mips/mm/cache.c: __uncached_access */
+1 -1
arch/mips/loongson/common/pci.c
··· 68 68 deassert for some broken device */ 69 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 73 * set cpu addr window2 to map CPU address space to PCI address space 74 74 */