aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/86xx
diff options
context:
space:
mode:
authorXianghua Xiao <x.xiao@freescale.com>2007-10-03 16:09:33 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-10-08 09:38:31 -0400
commit0e65bfe34c1000581746b9889d095241c4cf4a5c (patch)
tree4ea65b112435055fff0e3ab759b6d85488f62b9d /arch/powerpc/platforms/86xx
parent61c5d3cde10689867b86c8352aa0295637e941cb (diff)
[POWERPC] Add initial MPC8610 HPCD Platform files.
Add basic board support for the MPC8610 HPCD. This does not include any support the SoC Display or Audio controllers. Signed-off-by: Xianghua Xiao <x.xiao@freescale.com> Signed-off-by: Jason Jin <Jason.jin@freescale.com> Signed-off-by: Jon Loelier <jdl@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/86xx')
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig13
-rw-r--r--arch/powerpc/platforms/86xx/Makefile1
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c233
3 files changed, 247 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 685b2fbbbe00..21d113536b86 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -11,6 +11,12 @@ config MPC8641_HPCN
11 help 11 help
12 This option enables support for the MPC8641 HPCN board. 12 This option enables support for the MPC8641 HPCN board.
13 13
14config MPC8610_HPCD
15 bool "Freescale MPC8610 HPCD"
16 select DEFAULT_UIMAGE
17 help
18 This option enables support for the MPC8610 HPCD board.
19
14endchoice 20endchoice
15 21
16config MPC8641 22config MPC8641
@@ -19,3 +25,10 @@ config MPC8641
19 select PPC_UDBG_16550 25 select PPC_UDBG_16550
20 select MPIC 26 select MPIC
21 default y if MPC8641_HPCN 27 default y if MPC8641_HPCN
28
29config MPC8610
30 bool
31 select FSL_PCI if PCI
32 select PPC_UDBG_16550
33 select MPIC
34 default y if MPC8610_HPCD
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile
index 3376c7767f2d..c96706327eaa 100644
--- a/arch/powerpc/platforms/86xx/Makefile
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -4,3 +4,4 @@
4 4
5obj-$(CONFIG_SMP) += mpc86xx_smp.o 5obj-$(CONFIG_SMP) += mpc86xx_smp.o
6obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o 6obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
7obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
new file mode 100644
index 000000000000..c794d88fa55f
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -0,0 +1,233 @@
1/*
2 * MPC8610 HPCD board specific routines
3 *
4 * Initial author: Xianghua Xiao <x.xiao@freescale.com>
5 * Recode: Jason Jin <jason.jin@freescale.com>
6 *
7 * Rewrite the interrupt routing. remove the 8259PIC support,
8 * All the integrated device in ULI use sideband interrupt.
9 *
10 * Copyright 2007 Freescale Semiconductor Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/stddef.h>
19#include <linux/kernel.h>
20#include <linux/pci.h>
21#include <linux/kdev_t.h>
22#include <linux/delay.h>
23#include <linux/seq_file.h>
24#include <linux/of.h>
25
26#include <asm/system.h>
27#include <asm/time.h>
28#include <asm/machdep.h>
29#include <asm/pci-bridge.h>
30#include <asm/mpc86xx.h>
31#include <asm/prom.h>
32#include <mm/mmu_decl.h>
33#include <asm/udbg.h>
34
35#include <asm/mpic.h>
36
37#include <sysdev/fsl_pci.h>
38#include <sysdev/fsl_soc.h>
39
40#define MPC86XX_RSTCR_OFFSET (0xe00b0) /* Reset Control Register */
41
42void __init
43mpc86xx_hpcd_init_irq(void)
44{
45 struct mpic *mpic1;
46 struct device_node *np;
47 struct resource res;
48
49 /* Determine PIC address. */
50 np = of_find_node_by_type(NULL, "open-pic");
51 if (np == NULL)
52 return;
53 of_address_to_resource(np, 0, &res);
54
55 /* Alloc mpic structure and per isu has 16 INT entries. */
56 mpic1 = mpic_alloc(np, res.start,
57 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
58 0, 256, " MPIC ");
59 BUG_ON(mpic1 == NULL);
60
61 mpic_init(mpic1);
62}
63
64#ifdef CONFIG_PCI
65static void __devinit quirk_uli1575(struct pci_dev *dev)
66{
67 u32 temp32;
68
69 /* Disable INTx */
70 pci_read_config_dword(dev, 0x48, &temp32);
71 pci_write_config_dword(dev, 0x48, (temp32 | 1<<26));
72
73 /* Enable sideband interrupt */
74 pci_read_config_dword(dev, 0x90, &temp32);
75 pci_write_config_dword(dev, 0x90, (temp32 | 1<<22));
76}
77
78static void __devinit quirk_uli5288(struct pci_dev *dev)
79{
80 unsigned char c;
81 unsigned short temp;
82
83 /* Interrupt Disable, Needed when SATA disabled */
84 pci_read_config_word(dev, PCI_COMMAND, &temp);
85 temp |= 1<<10;
86 pci_write_config_word(dev, PCI_COMMAND, temp);
87
88 pci_read_config_byte(dev, 0x83, &c);
89 c |= 0x80;
90 pci_write_config_byte(dev, 0x83, c);
91
92 pci_write_config_byte(dev, PCI_CLASS_PROG, 0x01);
93 pci_write_config_byte(dev, PCI_CLASS_DEVICE, 0x06);
94
95 pci_read_config_byte(dev, 0x83, &c);
96 c &= 0x7f;
97 pci_write_config_byte(dev, 0x83, c);
98}
99
100/*
101 * Since 8259PIC was disabled on the board, the IDE device can not
102 * use the legacy IRQ, we need to let the IDE device work under
103 * native mode and use the interrupt line like other PCI devices.
104 * IRQ14 is a sideband interrupt from IDE device to CPU and we use this
105 * as the interrupt for IDE device.
106 */
107static void __devinit quirk_uli5229(struct pci_dev *dev)
108{
109 unsigned char c;
110
111 pci_read_config_byte(dev, 0x4b, &c);
112 c |= 0x10;
113 pci_write_config_byte(dev, 0x4b, c);
114}
115
116/*
117 * SATA interrupt pin bug fix
118 * There's a chip bug for 5288, The interrupt pin should be 2,
119 * not the read only value 1, So it use INTB#, not INTA# which
120 * actually used by the IDE device 5229.
121 * As of this bug, during the PCI initialization, 5288 read the
122 * irq of IDE device from the device tree, this function fix this
123 * bug by re-assigning a correct irq to 5288.
124 *
125 */
126static void __devinit final_uli5288(struct pci_dev *dev)
127{
128 struct pci_controller *hose = pci_bus_to_host(dev->bus);
129 struct device_node *hosenode = hose ? hose->arch_data : NULL;
130 struct of_irq oirq;
131 int virq, pin = 2;
132 u32 laddr[3];
133
134 if (!hosenode)
135 return;
136
137 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8);
138 laddr[1] = laddr[2] = 0;
139 of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq);
140 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
141 oirq.size);
142 dev->irq = virq;
143}
144
145DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
146DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
147DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
148DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5288, final_uli5288);
149#endif /* CONFIG_PCI */
150
151static void __init
152mpc86xx_hpcd_setup_arch(void)
153{
154#ifdef CONFIG_PCI
155 struct device_node *np;
156#endif
157 if (ppc_md.progress)
158 ppc_md.progress("mpc86xx_hpcd_setup_arch()", 0);
159
160#ifdef CONFIG_PCI
161 for_each_node_by_type(np, "pci") {
162 if (of_device_is_compatible(np, "fsl,mpc8610-pci")
163 || of_device_is_compatible(np, "fsl,mpc8641-pcie")) {
164 struct resource rsrc;
165 of_address_to_resource(np, 0, &rsrc);
166 if ((rsrc.start & 0xfffff) == 0xa000)
167 fsl_add_bridge(np, 1);
168 else
169 fsl_add_bridge(np, 0);
170 }
171 }
172#endif
173
174 printk("MPC86xx HPCD board from Freescale Semiconductor\n");
175}
176
177/*
178 * Called very early, device-tree isn't unflattened
179 */
180static int __init mpc86xx_hpcd_probe(void)
181{
182 unsigned long root = of_get_flat_dt_root();
183
184 if (of_flat_dt_is_compatible(root, "fsl,MPC8610HPCD"))
185 return 1; /* Looks good */
186
187 return 0;
188}
189
190void
191mpc86xx_restart(char *cmd)
192{
193 void __iomem *rstcr;
194
195 rstcr = ioremap(get_immrbase() + MPC86XX_RSTCR_OFFSET, 0x100);
196
197 local_irq_disable();
198
199 /* Assert reset request to Reset Control Register */
200 out_be32(rstcr, 0x2);
201
202 /* not reached */
203}
204
205long __init
206mpc86xx_time_init(void)
207{
208 unsigned int temp;
209
210 /* Set the time base to zero */
211 mtspr(SPRN_TBWL, 0);
212 mtspr(SPRN_TBWU, 0);
213
214 temp = mfspr(SPRN_HID0);
215 temp |= HID0_TBEN;
216 mtspr(SPRN_HID0, temp);
217 asm volatile("isync");
218
219 return 0;
220}
221
222define_machine(mpc86xx_hpcd) {
223 .name = "MPC86xx HPCD",
224 .probe = mpc86xx_hpcd_probe,
225 .setup_arch = mpc86xx_hpcd_setup_arch,
226 .init_IRQ = mpc86xx_hpcd_init_irq,
227 .get_irq = mpic_get_irq,
228 .restart = mpc86xx_restart,
229 .time_init = mpc86xx_time_init,
230 .calibrate_decr = generic_calibrate_decr,
231 .progress = udbg_progress,
232 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
233};