diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 20:58:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 20:58:08 -0400 |
commit | 489de30259e667d7bc47da9da44a0270b050cd97 (patch) | |
tree | 6807814f443fe2c5d041c3bc3fe3ca8d22a955ca /arch/ppc/syslib | |
parent | 1f1c2881f673671539b25686df463518d69c4649 (diff) | |
parent | bf22f6fe2d72b4d7e9035be8ceb340414cf490e3 (diff) |
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (209 commits)
[POWERPC] Create add_rtc() function to enable the RTC CMOS driver
[POWERPC] Add H_ILLAN_ATTRIBUTES hcall number
[POWERPC] xilinxfb: Parameterize xilinxfb platform device registration
[POWERPC] Oprofile support for Power 5++
[POWERPC] Enable arbitary speed tty ioctls and split input/output speed
[POWERPC] Make drivers/char/hvc_console.c:khvcd() static
[POWERPC] Remove dead code for preventing pread() and pwrite() calls
[POWERPC] Remove unnecessary #undef printk from prom.c
[POWERPC] Fix typo in Ebony default DTS
[POWERPC] Check for NULL ppc_md.init_IRQ() before calling
[POWERPC] Remove extra return statement
[POWERPC] pasemi: Don't auto-select CONFIG_EMBEDDED
[POWERPC] pasemi: Rename platform
[POWERPC] arch/powerpc/kernel/sysfs.c: Move NUMA exports
[POWERPC] Add __read_mostly support for powerpc
[POWERPC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane
[POWERPC] Create a dummy zImage if no valid platform has been selected
[POWERPC] PS3: Bootwrapper support.
[POWERPC] powermac i2c: Use mutex
[POWERPC] Schedule removal of arch/ppc
...
Fixed up conflicts manually in:
Documentation/feature-removal-schedule.txt
arch/powerpc/kernel/pci_32.c
arch/powerpc/kernel/pci_64.c
include/asm-powerpc/pci.h
and asked the powerpc people to double-check the result..
Diffstat (limited to 'arch/ppc/syslib')
-rw-r--r-- | arch/ppc/syslib/Makefile | 1 | ||||
-rw-r--r-- | arch/ppc/syslib/indirect_pci.c | 134 | ||||
-rw-r--r-- | arch/ppc/syslib/virtex_devices.c | 38 |
3 files changed, 160 insertions, 13 deletions
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile index 95694159b226..543795be58c8 100644 --- a/arch/ppc/syslib/Makefile +++ b/arch/ppc/syslib/Makefile | |||
@@ -7,6 +7,7 @@ CFLAGS_btext.o += -fPIC | |||
7 | 7 | ||
8 | wdt-mpc8xx-$(CONFIG_8xx_WDT) += m8xx_wdt.o | 8 | wdt-mpc8xx-$(CONFIG_8xx_WDT) += m8xx_wdt.o |
9 | 9 | ||
10 | obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o | ||
10 | obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o | 11 | obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o |
11 | obj-$(CONFIG_PPC_OCP) += ocp.o | 12 | obj-$(CONFIG_PPC_OCP) += ocp.o |
12 | obj-$(CONFIG_IBM_OCP) += ibm_ocp.o | 13 | obj-$(CONFIG_IBM_OCP) += ibm_ocp.o |
diff --git a/arch/ppc/syslib/indirect_pci.c b/arch/ppc/syslib/indirect_pci.c new file mode 100644 index 000000000000..83b323a7d029 --- /dev/null +++ b/arch/ppc/syslib/indirect_pci.c | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * Support for indirect PCI bridges. | ||
3 | * | ||
4 | * Copyright (C) 1998 Gabriel Paubert. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/init.h> | ||
17 | |||
18 | #include <asm/io.h> | ||
19 | #include <asm/prom.h> | ||
20 | #include <asm/pci-bridge.h> | ||
21 | #include <asm/machdep.h> | ||
22 | |||
23 | #ifdef CONFIG_PPC_INDIRECT_PCI_BE | ||
24 | #define PCI_CFG_OUT out_be32 | ||
25 | #else | ||
26 | #define PCI_CFG_OUT out_le32 | ||
27 | #endif | ||
28 | |||
29 | static int | ||
30 | indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
31 | int len, u32 *val) | ||
32 | { | ||
33 | struct pci_controller *hose = bus->sysdata; | ||
34 | volatile void __iomem *cfg_data; | ||
35 | u8 cfg_type = 0; | ||
36 | |||
37 | if (ppc_md.pci_exclude_device) | ||
38 | if (ppc_md.pci_exclude_device(bus->number, devfn)) | ||
39 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
40 | |||
41 | if (hose->set_cfg_type) | ||
42 | if (bus->number != hose->first_busno) | ||
43 | cfg_type = 1; | ||
44 | |||
45 | PCI_CFG_OUT(hose->cfg_addr, | ||
46 | (0x80000000 | ((bus->number - hose->bus_offset) << 16) | ||
47 | | (devfn << 8) | ((offset & 0xfc) | cfg_type))); | ||
48 | |||
49 | /* | ||
50 | * Note: the caller has already checked that offset is | ||
51 | * suitably aligned and that len is 1, 2 or 4. | ||
52 | */ | ||
53 | cfg_data = hose->cfg_data + (offset & 3); | ||
54 | switch (len) { | ||
55 | case 1: | ||
56 | *val = in_8(cfg_data); | ||
57 | break; | ||
58 | case 2: | ||
59 | *val = in_le16(cfg_data); | ||
60 | break; | ||
61 | default: | ||
62 | *val = in_le32(cfg_data); | ||
63 | break; | ||
64 | } | ||
65 | return PCIBIOS_SUCCESSFUL; | ||
66 | } | ||
67 | |||
68 | static int | ||
69 | indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset, | ||
70 | int len, u32 val) | ||
71 | { | ||
72 | struct pci_controller *hose = bus->sysdata; | ||
73 | volatile void __iomem *cfg_data; | ||
74 | u8 cfg_type = 0; | ||
75 | |||
76 | if (ppc_md.pci_exclude_device) | ||
77 | if (ppc_md.pci_exclude_device(bus->number, devfn)) | ||
78 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
79 | |||
80 | if (hose->set_cfg_type) | ||
81 | if (bus->number != hose->first_busno) | ||
82 | cfg_type = 1; | ||
83 | |||
84 | PCI_CFG_OUT(hose->cfg_addr, | ||
85 | (0x80000000 | ((bus->number - hose->bus_offset) << 16) | ||
86 | | (devfn << 8) | ((offset & 0xfc) | cfg_type))); | ||
87 | |||
88 | /* | ||
89 | * Note: the caller has already checked that offset is | ||
90 | * suitably aligned and that len is 1, 2 or 4. | ||
91 | */ | ||
92 | cfg_data = hose->cfg_data + (offset & 3); | ||
93 | switch (len) { | ||
94 | case 1: | ||
95 | out_8(cfg_data, val); | ||
96 | break; | ||
97 | case 2: | ||
98 | out_le16(cfg_data, val); | ||
99 | break; | ||
100 | default: | ||
101 | out_le32(cfg_data, val); | ||
102 | break; | ||
103 | } | ||
104 | return PCIBIOS_SUCCESSFUL; | ||
105 | } | ||
106 | |||
107 | static struct pci_ops indirect_pci_ops = | ||
108 | { | ||
109 | indirect_read_config, | ||
110 | indirect_write_config | ||
111 | }; | ||
112 | |||
113 | void __init | ||
114 | setup_indirect_pci_nomap(struct pci_controller* hose, void __iomem * cfg_addr, | ||
115 | void __iomem * cfg_data) | ||
116 | { | ||
117 | hose->cfg_addr = cfg_addr; | ||
118 | hose->cfg_data = cfg_data; | ||
119 | hose->ops = &indirect_pci_ops; | ||
120 | } | ||
121 | |||
122 | void __init | ||
123 | setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data) | ||
124 | { | ||
125 | unsigned long base = cfg_addr & PAGE_MASK; | ||
126 | void __iomem *mbase, *addr, *data; | ||
127 | |||
128 | mbase = ioremap(base, PAGE_SIZE); | ||
129 | addr = mbase + (cfg_addr & ~PAGE_MASK); | ||
130 | if ((cfg_data & PAGE_MASK) != base) | ||
131 | mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE); | ||
132 | data = mbase + (cfg_data & ~PAGE_MASK); | ||
133 | setup_indirect_pci_nomap(hose, addr, data); | ||
134 | } | ||
diff --git a/arch/ppc/syslib/virtex_devices.c b/arch/ppc/syslib/virtex_devices.c index 16546788e23b..ace4ec08de51 100644 --- a/arch/ppc/syslib/virtex_devices.c +++ b/arch/ppc/syslib/virtex_devices.c | |||
@@ -71,6 +71,21 @@ | |||
71 | }, \ | 71 | }, \ |
72 | } | 72 | } |
73 | 73 | ||
74 | /* | ||
75 | * ML300/ML403 Video Device: shortcut macro for single instance | ||
76 | */ | ||
77 | #define XPAR_TFT(num) { \ | ||
78 | .name = "xilinxfb", \ | ||
79 | .id = num, \ | ||
80 | .num_resources = 1, \ | ||
81 | .resource = (struct resource[]) { \ | ||
82 | { \ | ||
83 | .start = XPAR_TFT_##num##_BASEADDR, \ | ||
84 | .end = XPAR_TFT_##num##_BASEADDR+7, \ | ||
85 | .flags = IORESOURCE_IO, \ | ||
86 | }, \ | ||
87 | }, \ | ||
88 | } | ||
74 | 89 | ||
75 | /* UART 8250 driver platform data table */ | 90 | /* UART 8250 driver platform data table */ |
76 | struct plat_serial8250_port virtex_serial_platform_data[] = { | 91 | struct plat_serial8250_port virtex_serial_platform_data[] = { |
@@ -146,20 +161,17 @@ struct platform_device virtex_platform_devices[] = { | |||
146 | XPAR_SYSACE(1), | 161 | XPAR_SYSACE(1), |
147 | #endif | 162 | #endif |
148 | 163 | ||
149 | /* ML300/403 reference design framebuffer */ | ||
150 | #if defined(XPAR_TFT_0_BASEADDR) | 164 | #if defined(XPAR_TFT_0_BASEADDR) |
151 | { | 165 | XPAR_TFT(0), |
152 | .name = "xilinxfb", | 166 | #endif |
153 | .id = 0, | 167 | #if defined(XPAR_TFT_1_BASEADDR) |
154 | .num_resources = 1, | 168 | XPAR_TFT(1), |
155 | .resource = (struct resource[]) { | 169 | #endif |
156 | { | 170 | #if defined(XPAR_TFT_2_BASEADDR) |
157 | .start = XPAR_TFT_0_BASEADDR, | 171 | XPAR_TFT(2), |
158 | .end = XPAR_TFT_0_BASEADDR+7, | 172 | #endif |
159 | .flags = IORESOURCE_IO, | 173 | #if defined(XPAR_TFT_3_BASEADDR) |
160 | }, | 174 | XPAR_TFT(3), |
161 | }, | ||
162 | }, | ||
163 | #endif | 175 | #endif |
164 | }; | 176 | }; |
165 | 177 | ||