提交 55045ff5 编写于 作者: W Wu Zhangjin 提交者: Ralf Baechle

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: NWu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
上级 6e34358e
...@@ -1334,6 +1334,8 @@ config SYS_HAS_CPU_LOONGSON2E ...@@ -1334,6 +1334,8 @@ config SYS_HAS_CPU_LOONGSON2E
config SYS_HAS_CPU_LOONGSON2F config SYS_HAS_CPU_LOONGSON2F
bool bool
select CPU_SUPPORTS_CPUFREQ
select CPU_SUPPORTS_ADDRWINCFG if 64BIT
config SYS_HAS_CPU_MIPS32_R1 config SYS_HAS_CPU_MIPS32_R1
bool bool
...@@ -1443,6 +1445,10 @@ config CPU_SUPPORTS_32BIT_KERNEL ...@@ -1443,6 +1445,10 @@ config CPU_SUPPORTS_32BIT_KERNEL
bool bool
config CPU_SUPPORTS_64BIT_KERNEL config CPU_SUPPORTS_64BIT_KERNEL
bool bool
config CPU_SUPPORTS_CPUFREQ
bool
config CPU_SUPPORTS_ADDRWINCFG
bool
config CPU_SUPPORTS_HUGEPAGES config CPU_SUPPORTS_HUGEPAGES
bool bool
config MIPS_PGD_C0_CONTEXT config MIPS_PGD_C0_CONTEXT
......
...@@ -227,7 +227,7 @@ extern void mach_irq_dispatch(unsigned int pending); ...@@ -227,7 +227,7 @@ extern void mach_irq_dispatch(unsigned int pending);
((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6)) ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
/* Chip Config */ /* Chip Config */
#ifdef CONFIG_CPU_LOONGSON2F #ifdef CONFIG_CPU_SUPPORTS_CPUFREQ
#define LOONGSON_CHIPCFG0 LOONGSON_REG(LOONGSON_REGBASE + 0x80) #define LOONGSON_CHIPCFG0 LOONGSON_REG(LOONGSON_REGBASE + 0x80)
#endif #endif
...@@ -236,7 +236,7 @@ extern void mach_irq_dispatch(unsigned int pending); ...@@ -236,7 +236,7 @@ extern void mach_irq_dispatch(unsigned int pending);
* *
* loongson2e do not have this module * loongson2e do not have this module
*/ */
#if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
/* address window config module base address */ /* address window config module base address */
#define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul #define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul
...@@ -306,6 +306,6 @@ extern unsigned long _loongson_addrwincfg_base; ...@@ -306,6 +306,6 @@ extern unsigned long _loongson_addrwincfg_base;
#define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \ #define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \
LOONGSON_ADDRWIN_CFG(PCIDMA, DDR, win, src, dst, size) LOONGSON_ADDRWIN_CFG(PCIDMA, DDR, win, src, dst, size)
#endif /* ! CONFIG_CPU_LOONGSON2F && CONFIG_64BIT */ #endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */
#endif /* __ASM_MACH_LOONGSON_LOONGSON_H */ #endif /* __ASM_MACH_LOONGSON_LOONGSON_H */
...@@ -28,7 +28,7 @@ extern struct pci_ops loongson_pci_ops; ...@@ -28,7 +28,7 @@ extern struct pci_ops loongson_pci_ops;
/* this is an offset from mips_io_port_base */ /* this is an offset from mips_io_port_base */
#define LOONGSON_PCI_IO_START 0x00004000UL #define LOONGSON_PCI_IO_START 0x00004000UL
#if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
/* /*
* we use address window2 to map cpu address space to pci space * we use address window2 to map cpu address space to pci space
...@@ -56,6 +56,6 @@ extern struct pci_ops loongson_pci_ops; ...@@ -56,6 +56,6 @@ extern struct pci_ops loongson_pci_ops;
/* this is an offset from mips_io_port_base */ /* this is an offset from mips_io_port_base */
#define LOONGSON_PCI_IO_START 0x00004000UL #define LOONGSON_PCI_IO_START 0x00004000UL
#endif /* !(defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT))*/ #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */
#endif /* !__ASM_MACH_LOONGSON_PCI_H_ */ #endif /* !__ASM_MACH_LOONGSON_PCI_H_ */
...@@ -21,7 +21,7 @@ void __init prom_init(void) ...@@ -21,7 +21,7 @@ void __init prom_init(void)
set_io_port_base((unsigned long) set_io_port_base((unsigned long)
ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE)); ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
#if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
_loongson_addrwincfg_base = (unsigned long) _loongson_addrwincfg_base = (unsigned long)
ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE); ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE);
#endif #endif
......
...@@ -20,8 +20,7 @@ void __init prom_init_memory(void) ...@@ -20,8 +20,7 @@ void __init prom_init_memory(void)
add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize << add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize <<
20), BOOT_MEM_RESERVED); 20), BOOT_MEM_RESERVED);
#ifdef CONFIG_64BIT #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
#ifdef CONFIG_CPU_LOONGSON2F
{ {
int bit; int bit;
...@@ -36,8 +35,9 @@ void __init prom_init_memory(void) ...@@ -36,8 +35,9 @@ void __init prom_init_memory(void)
0x80000000ul, (1 << bit)); 0x80000000ul, (1 << bit));
mmiowb(); mmiowb();
} }
#endif /* CONFIG_CPU_LOONGSON2F */ #endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */
#ifdef CONFIG_64BIT
if (highmemsize > 0) if (highmemsize > 0)
add_memory_region(LOONGSON_HIGHMEM_START, add_memory_region(LOONGSON_HIGHMEM_START,
highmemsize << 20, BOOT_MEM_RAM); highmemsize << 20, BOOT_MEM_RAM);
...@@ -45,7 +45,7 @@ void __init prom_init_memory(void) ...@@ -45,7 +45,7 @@ void __init prom_init_memory(void)
add_memory_region(LOONGSON_PCI_MEM_END + 1, LOONGSON_HIGHMEM_START - add_memory_region(LOONGSON_PCI_MEM_END + 1, LOONGSON_HIGHMEM_START -
LOONGSON_PCI_MEM_END - 1, BOOT_MEM_RESERVED); LOONGSON_PCI_MEM_END - 1, BOOT_MEM_RESERVED);
#endif /* CONFIG_64BIT */ #endif /* !CONFIG_64BIT */
} }
/* override of arch/mips/mm/cache.c: __uncached_access */ /* override of arch/mips/mm/cache.c: __uncached_access */
......
...@@ -68,7 +68,7 @@ static void __init setup_pcimap(void) ...@@ -68,7 +68,7 @@ static void __init setup_pcimap(void)
deassert for some broken device */ deassert for some broken device */
LOONGSON_PXARB_CFG = 0x00fe0105ul; LOONGSON_PXARB_CFG = 0x00fe0105ul;
#if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) #ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
/* /*
* set cpu addr window2 to map CPU address space to PCI address space * set cpu addr window2 to map CPU address space to PCI address space
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册