diff options
author | Wu Zhangjin <wuzhangjin@gmail.com> | 2009-07-02 11:23:30 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-09-17 14:07:46 -0400 |
commit | f7face03c66cea12159191ba8d2a9ee735da0b0d (patch) | |
tree | 88de3a5f53b09946a2500efb578417659ddb5e42 /arch | |
parent | 5e983ff654ca3df3007b5b558b5271bb4622afa4 (diff) |
MIPS: Loongson: PCI: Clean up pcimap setup
Fixup the wrong original comment of pcimap, and make the source code more
understandable. and also, some new extra consideration is added in.
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/include/asm/mach-lemote/loongson.h | 17 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-lemote/pci.h | 4 | ||||
-rw-r--r-- | arch/mips/lemote/lm2e/pci.c | 41 |
3 files changed, 45 insertions, 17 deletions
diff --git a/arch/mips/include/asm/mach-lemote/loongson.h b/arch/mips/include/asm/mach-lemote/loongson.h index 76cc2bddfa43..916eacec94ec 100644 --- a/arch/mips/include/asm/mach-lemote/loongson.h +++ b/arch/mips/include/asm/mach-lemote/loongson.h | |||
@@ -33,4 +33,21 @@ extern void __init prom_init_memory(void); | |||
33 | extern void __init prom_init_cmdline(void); | 33 | extern void __init prom_init_cmdline(void); |
34 | extern void __init prom_init_env(void); | 34 | extern void __init prom_init_env(void); |
35 | 35 | ||
36 | /* PCI Configuration Registers */ | ||
37 | #define LOONGSON_PCI_ISR4C BONITO_PCI_REG(0x4c) | ||
38 | |||
39 | /* PCI_Hit*_Sel_* */ | ||
40 | |||
41 | #define LOONGSON_PCI_HIT0_SEL_L BONITO(BONITO_REGBASE + 0x50) | ||
42 | #define LOONGSON_PCI_HIT0_SEL_H BONITO(BONITO_REGBASE + 0x54) | ||
43 | #define LOONGSON_PCI_HIT1_SEL_L BONITO(BONITO_REGBASE + 0x58) | ||
44 | #define LOONGSON_PCI_HIT1_SEL_H BONITO(BONITO_REGBASE + 0x5c) | ||
45 | #define LOONGSON_PCI_HIT2_SEL_L BONITO(BONITO_REGBASE + 0x60) | ||
46 | #define LOONGSON_PCI_HIT2_SEL_H BONITO(BONITO_REGBASE + 0x64) | ||
47 | |||
48 | /* PXArb Config & Status */ | ||
49 | |||
50 | #define LOONGSON_PXARB_CFG BONITO(BONITO_REGBASE + 0x68) | ||
51 | #define LOONGSON_PXARB_STATUS BONITO(BONITO_REGBASE + 0x6c) | ||
52 | |||
36 | #endif /* __ASM_MACH_LOONGSON_LOONGSON_H */ | 53 | #endif /* __ASM_MACH_LOONGSON_LOONGSON_H */ |
diff --git a/arch/mips/include/asm/mach-lemote/pci.h b/arch/mips/include/asm/mach-lemote/pci.h index 92b2f59d890f..3e6b1300afb6 100644 --- a/arch/mips/include/asm/mach-lemote/pci.h +++ b/arch/mips/include/asm/mach-lemote/pci.h | |||
@@ -24,8 +24,8 @@ | |||
24 | 24 | ||
25 | extern struct pci_ops bonito64_pci_ops; | 25 | extern struct pci_ops bonito64_pci_ops; |
26 | 26 | ||
27 | #define LOONGSON2E_PCI_MEM_START 0x14000000UL | 27 | #define LOONGSON2E_PCI_MEM_START BONITO_PCILO1_BASE |
28 | #define LOONGSON2E_PCI_MEM_END 0x1fffffffUL | 28 | #define LOONGSON2E_PCI_MEM_END (BONITO_PCILO1_BASE + 0x04000000 * 2) |
29 | #define LOONGSON2E_PCI_IO_START 0x00004000UL | 29 | #define LOONGSON2E_PCI_IO_START 0x00004000UL |
30 | 30 | ||
31 | #endif /* !__ASM_MACH_LEMOTE_PCI_H_ */ | 31 | #endif /* !__ASM_MACH_LEMOTE_PCI_H_ */ |
diff --git a/arch/mips/lemote/lm2e/pci.c b/arch/mips/lemote/lm2e/pci.c index bee846e6d8a8..9812c30cc6eb 100644 --- a/arch/mips/lemote/lm2e/pci.c +++ b/arch/mips/lemote/lm2e/pci.c | |||
@@ -34,33 +34,44 @@ static struct pci_controller loongson2e_pci_controller = { | |||
34 | .io_offset = 0x00000000UL, | 34 | .io_offset = 0x00000000UL, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | static void __init ict_pcimap(void) | 37 | static void __init setup_pcimap(void) |
38 | { | 38 | { |
39 | /* | 39 | /* |
40 | * local to PCI mapping: [256M,512M] -> [256M,512M]; differ from PMON | 40 | * local to PCI mapping for CPU accessing PCI space |
41 | * | ||
42 | * CPU address space [256M,448M] is window for accessing pci space | 41 | * CPU address space [256M,448M] is window for accessing pci space |
43 | * we set pcimap_lo[0,1,2] to map it to pci space [256M,448M] | 42 | * we set pcimap_lo[0,1,2] to map it to pci space[0M,64M], [320M,448M] |
44 | * pcimap: bit18,pcimap_2; bit[17-12],lo2;bit[11-6],lo1;bit[5-0],lo0 | 43 | * |
44 | * pcimap: PCI_MAP2 PCI_Mem_Lo2 PCI_Mem_Lo1 PCI_Mem_Lo0 | ||
45 | * [<2G] [384M,448M] [320M,384M] [0M,64M] | ||
45 | */ | 46 | */ |
46 | /* 1,00 0110 ,0001 01,00 0000 */ | 47 | BONITO_PCIMAP = BONITO_PCIMAP_PCIMAP_2 | |
47 | BONITO_PCIMAP = 0x46140; | 48 | BONITO_PCIMAP_WIN(2, BONITO_PCILO2_BASE) | |
48 | 49 | BONITO_PCIMAP_WIN(1, BONITO_PCILO1_BASE) | | |
49 | /* 1, 00 0010, 0000,01, 00 0000 */ | 50 | BONITO_PCIMAP_WIN(0, 0); |
50 | /* BONITO_PCIMAP = 0x42040; */ | ||
51 | 51 | ||
52 | /* | 52 | /* |
53 | * PCI to local mapping: [2G,2G+256M] -> [0,256M] | 53 | * PCI-DMA to local mapping: [2G,2G+256M] -> [0M,256M] |
54 | */ | 54 | */ |
55 | BONITO_PCIBASE0 = 0x80000000; | 55 | BONITO_PCIBASE0 = 0x80000000ul; /* base: 2G -> mmap: 0M */ |
56 | BONITO_PCIBASE1 = 0x00800000; | 56 | /* size: 256M, burst transmission, pre-fetch enable, 64bit */ |
57 | BONITO_PCIBASE2 = 0x90000000; | 57 | LOONGSON_PCI_HIT0_SEL_L = 0xc000000cul; |
58 | LOONGSON_PCI_HIT0_SEL_H = 0xfffffffful; | ||
59 | LOONGSON_PCI_HIT1_SEL_L = 0x00000006ul; /* set this BAR as invalid */ | ||
60 | LOONGSON_PCI_HIT1_SEL_H = 0x00000000ul; | ||
61 | LOONGSON_PCI_HIT2_SEL_L = 0x00000006ul; /* set this BAR as invalid */ | ||
62 | LOONGSON_PCI_HIT2_SEL_H = 0x00000000ul; | ||
63 | |||
64 | /* avoid deadlock of PCI reading/writing lock operation */ | ||
65 | LOONGSON_PCI_ISR4C = 0xd2000001ul; | ||
58 | 66 | ||
67 | /* can not change gnt to break pci transfer when device's gnt not | ||
68 | deassert for some broken device */ | ||
69 | LOONGSON_PXARB_CFG = 0x00fe0105ul; | ||
59 | } | 70 | } |
60 | 71 | ||
61 | static int __init pcibios_init(void) | 72 | static int __init pcibios_init(void) |
62 | { | 73 | { |
63 | ict_pcimap(); | 74 | setup_pcimap(); |
64 | 75 | ||
65 | loongson2e_pci_controller.io_map_base = mips_io_port_base; | 76 | loongson2e_pci_controller.io_map_base = mips_io_port_base; |
66 | 77 | ||