diff options
author | Paul Mackerras <paulus@samba.org> | 2006-09-27 17:18:28 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-09-27 17:18:28 -0400 |
commit | 4e6d816e51728d5006c53e78e079ac62b902f8aa (patch) | |
tree | d388c87dabc063c08c52d17610738d2f49b3855c /arch/powerpc/platforms/85xx/mpc85xx_ads.c | |
parent | d86d9b8cab45adf64e2ea8fe975bec3282b5de81 (diff) | |
parent | 611a15afcdaacec6efba984c7eb089b853564bdf (diff) |
Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/vitb/linux-2.6-PQ
Diffstat (limited to 'arch/powerpc/platforms/85xx/mpc85xx_ads.c')
-rw-r--r-- | arch/powerpc/platforms/85xx/mpc85xx_ads.c | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c index cae6b73357d5..28070e7ae507 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c | |||
@@ -32,6 +32,13 @@ | |||
32 | #include <sysdev/fsl_soc.h> | 32 | #include <sysdev/fsl_soc.h> |
33 | #include "mpc85xx.h" | 33 | #include "mpc85xx.h" |
34 | 34 | ||
35 | #ifdef CONFIG_CPM2 | ||
36 | #include <linux/fs_enet_pd.h> | ||
37 | #include <asm/cpm2.h> | ||
38 | #include <sysdev/cpm2_pic.h> | ||
39 | #include <asm/fs_pd.h> | ||
40 | #endif | ||
41 | |||
35 | #ifndef CONFIG_PCI | 42 | #ifndef CONFIG_PCI |
36 | unsigned long isa_io_base = 0; | 43 | unsigned long isa_io_base = 0; |
37 | unsigned long isa_mem_base = 0; | 44 | unsigned long isa_mem_base = 0; |
@@ -57,12 +64,29 @@ mpc85xx_pcibios_fixup(void) | |||
57 | } | 64 | } |
58 | #endif /* CONFIG_PCI */ | 65 | #endif /* CONFIG_PCI */ |
59 | 66 | ||
67 | #ifdef CONFIG_CPM2 | ||
68 | |||
69 | static void cpm2_cascade(unsigned int irq, struct irq_desc *desc, | ||
70 | struct pt_regs *regs) | ||
71 | { | ||
72 | int cascade_irq; | ||
73 | |||
74 | while ((cascade_irq = cpm2_get_irq(regs)) >= 0) { | ||
75 | generic_handle_irq(cascade_irq, regs); | ||
76 | } | ||
77 | desc->chip->eoi(irq); | ||
78 | } | ||
79 | |||
80 | #endif /* CONFIG_CPM2 */ | ||
60 | 81 | ||
61 | void __init mpc85xx_ads_pic_init(void) | 82 | void __init mpc85xx_ads_pic_init(void) |
62 | { | 83 | { |
63 | struct mpic *mpic; | 84 | struct mpic *mpic; |
64 | struct resource r; | 85 | struct resource r; |
65 | struct device_node *np = NULL; | 86 | struct device_node *np = NULL; |
87 | #ifdef CONFIG_CPM2 | ||
88 | int irq; | ||
89 | #endif | ||
66 | 90 | ||
67 | np = of_find_node_by_type(np, "open-pic"); | 91 | np = of_find_node_by_type(np, "open-pic"); |
68 | 92 | ||
@@ -104,11 +128,103 @@ void __init mpc85xx_ads_pic_init(void) | |||
104 | mpic_assign_isu(mpic, 14, r.start + 0x10100); | 128 | mpic_assign_isu(mpic, 14, r.start + 0x10100); |
105 | 129 | ||
106 | mpic_init(mpic); | 130 | mpic_init(mpic); |
131 | |||
132 | #ifdef CONFIG_CPM2 | ||
133 | /* Setup CPM2 PIC */ | ||
134 | np = of_find_node_by_type(NULL, "cpm-pic"); | ||
135 | if (np == NULL) { | ||
136 | printk(KERN_ERR "PIC init: can not find cpm-pic node\n"); | ||
137 | return; | ||
138 | } | ||
139 | irq = irq_of_parse_and_map(np, 0); | ||
140 | |||
141 | cpm2_pic_init(np); | ||
142 | set_irq_chained_handler(irq, cpm2_cascade); | ||
143 | #endif | ||
107 | } | 144 | } |
108 | 145 | ||
109 | /* | 146 | /* |
110 | * Setup the architecture | 147 | * Setup the architecture |
111 | */ | 148 | */ |
149 | #ifdef CONFIG_CPM2 | ||
150 | void init_fcc_ioports(struct fs_platform_info *fpi) | ||
151 | { | ||
152 | struct io_port *io = cpm2_map(im_ioport); | ||
153 | int fcc_no = fs_get_fcc_index(fpi->fs_no); | ||
154 | int target; | ||
155 | u32 tempval; | ||
156 | |||
157 | switch(fcc_no) { | ||
158 | case 1: | ||
159 | tempval = in_be32(&io->iop_pdirb); | ||
160 | tempval &= ~PB2_DIRB0; | ||
161 | tempval |= PB2_DIRB1; | ||
162 | out_be32(&io->iop_pdirb, tempval); | ||
163 | |||
164 | tempval = in_be32(&io->iop_psorb); | ||
165 | tempval &= ~PB2_PSORB0; | ||
166 | tempval |= PB2_PSORB1; | ||
167 | out_be32(&io->iop_psorb, tempval); | ||
168 | |||
169 | tempval = in_be32(&io->iop_pparb); | ||
170 | tempval |= (PB2_DIRB0 | PB2_DIRB1); | ||
171 | out_be32(&io->iop_pparb, tempval); | ||
172 | |||
173 | target = CPM_CLK_FCC2; | ||
174 | break; | ||
175 | case 2: | ||
176 | tempval = in_be32(&io->iop_pdirb); | ||
177 | tempval &= ~PB3_DIRB0; | ||
178 | tempval |= PB3_DIRB1; | ||
179 | out_be32(&io->iop_pdirb, tempval); | ||
180 | |||
181 | tempval = in_be32(&io->iop_psorb); | ||
182 | tempval &= ~PB3_PSORB0; | ||
183 | tempval |= PB3_PSORB1; | ||
184 | out_be32(&io->iop_psorb, tempval); | ||
185 | |||
186 | tempval = in_be32(&io->iop_pparb); | ||
187 | tempval |= (PB3_DIRB0 | PB3_DIRB1); | ||
188 | out_be32(&io->iop_pparb, tempval); | ||
189 | |||
190 | tempval = in_be32(&io->iop_pdirc); | ||
191 | tempval |= PC3_DIRC1; | ||
192 | out_be32(&io->iop_pdirc, tempval); | ||
193 | |||
194 | tempval = in_be32(&io->iop_pparc); | ||
195 | tempval |= PC3_DIRC1; | ||
196 | out_be32(&io->iop_pparc, tempval); | ||
197 | |||
198 | target = CPM_CLK_FCC3; | ||
199 | break; | ||
200 | default: | ||
201 | printk(KERN_ERR "init_fcc_ioports: invalid FCC number\n"); | ||
202 | return; | ||
203 | } | ||
204 | |||
205 | /* Port C has clocks...... */ | ||
206 | tempval = in_be32(&io->iop_psorc); | ||
207 | tempval &= ~(PC_CLK(fpi->clk_rx - 8) | PC_CLK(fpi->clk_tx - 8)); | ||
208 | out_be32(&io->iop_psorc, tempval); | ||
209 | |||
210 | tempval = in_be32(&io->iop_pdirc); | ||
211 | tempval &= ~(PC_CLK(fpi->clk_rx - 8) | PC_CLK(fpi->clk_tx - 8)); | ||
212 | out_be32(&io->iop_pdirc, tempval); | ||
213 | tempval = in_be32(&io->iop_pparc); | ||
214 | tempval |= (PC_CLK(fpi->clk_rx - 8) | PC_CLK(fpi->clk_tx - 8)); | ||
215 | out_be32(&io->iop_pparc, tempval); | ||
216 | |||
217 | cpm2_unmap(io); | ||
218 | |||
219 | /* Configure Serial Interface clock routing. | ||
220 | * First, clear FCC bits to zero, | ||
221 | * then set the ones we want. | ||
222 | */ | ||
223 | cpm2_clk_setup(target, fpi->clk_rx, CPM_CLK_RX); | ||
224 | cpm2_clk_setup(target, fpi->clk_tx, CPM_CLK_TX); | ||
225 | } | ||
226 | #endif | ||
227 | |||
112 | static void __init mpc85xx_ads_setup_arch(void) | 228 | static void __init mpc85xx_ads_setup_arch(void) |
113 | { | 229 | { |
114 | struct device_node *cpu; | 230 | struct device_node *cpu; |
@@ -131,6 +247,10 @@ static void __init mpc85xx_ads_setup_arch(void) | |||
131 | of_node_put(cpu); | 247 | of_node_put(cpu); |
132 | } | 248 | } |
133 | 249 | ||
250 | #ifdef CONFIG_CPM2 | ||
251 | cpm2_reset(); | ||
252 | #endif | ||
253 | |||
134 | #ifdef CONFIG_PCI | 254 | #ifdef CONFIG_PCI |
135 | for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) | 255 | for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) |
136 | add_bridge(np); | 256 | add_bridge(np); |