aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/platforms/lite5200.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc/platforms/lite5200.c')
-rw-r--r--arch/ppc/platforms/lite5200.c73
1 files changed, 40 insertions, 33 deletions
diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
index 7ed52dc340c9..fecbe9adc9e0 100644
--- a/arch/ppc/platforms/lite5200.c
+++ b/arch/ppc/platforms/lite5200.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/platforms/lite5200.c
3 *
4 * Platform support file for the Freescale LITE5200 based on MPC52xx. 2 * Platform support file for the Freescale LITE5200 based on MPC52xx.
5 * A maximum of this file should be moved to syslib/mpc52xx_????? 3 * A maximum of this file should be moved to syslib/mpc52xx_?????
6 * so that new platform based on MPC52xx need a minimal platform file 4 * so that new platform based on MPC52xx need a minimal platform file
@@ -36,8 +34,7 @@
36#include <asm/mpc52xx.h> 34#include <asm/mpc52xx.h>
37#include <asm/ppc_sys.h> 35#include <asm/ppc_sys.h>
38#include <asm/machdep.h> 36#include <asm/machdep.h>
39 37#include <asm/pci-bridge.h>
40#include <syslib/mpc52xx_pci.h>
41 38
42 39
43extern int powersave_nap; 40extern int powersave_nap;
@@ -70,44 +67,53 @@ lite5200_show_cpuinfo(struct seq_file *m)
70} 67}
71 68
72#ifdef CONFIG_PCI 69#ifdef CONFIG_PCI
70#ifdef CONFIG_LITE5200B
71static int
72lite5200_map_irq(struct pci_dev *dev, unsigned char idsel,
73 unsigned char pin)
74{
75 static char pci_irq_table[][4] =
76 /*
77 * PCI IDSEL/INTPIN->INTLINE
78 * A B C D
79 */
80 {
81 {MPC52xx_IRQ0, MPC52xx_IRQ1, MPC52xx_IRQ2, MPC52xx_IRQ3},
82 {MPC52xx_IRQ1, MPC52xx_IRQ2, MPC52xx_IRQ3, MPC52xx_IRQ0},
83 };
84
85 const long min_idsel = 24, max_idsel = 25, irqs_per_slot = 4;
86 return PCI_IRQ_TABLE_LOOKUP;
87}
88#else /* Original Lite */
73static int 89static int
74lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) 90lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
75{ 91{
76 return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1; 92 return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1;
77} 93}
78#endif 94#endif
95#endif
79 96
80static void __init 97static void __init
81lite5200_setup_cpu(void) 98lite5200_setup_cpu(void)
82{ 99{
83 struct mpc52xx_cdm __iomem *cdm;
84 struct mpc52xx_gpio __iomem *gpio; 100 struct mpc52xx_gpio __iomem *gpio;
85 struct mpc52xx_intr __iomem *intr; 101 struct mpc52xx_intr __iomem *intr;
86 struct mpc52xx_xlb __iomem *xlb;
87 102
88 u32 port_config; 103 u32 port_config;
89 u32 intr_ctrl; 104 u32 intr_ctrl;
90 105
91 /* Map zones */ 106 /* Map zones */
92 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
93 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); 107 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
94 xlb = ioremap(MPC52xx_PA(MPC52xx_XLB_OFFSET), MPC52xx_XLB_SIZE);
95 intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET), MPC52xx_INTR_SIZE); 108 intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET), MPC52xx_INTR_SIZE);
96 109
97 if (!cdm || !gpio || !xlb || !intr) { 110 if (!gpio || !intr) {
98 printk("lite5200.c: Error while mapping CDM/GPIO/XLB/INTR during" 111 printk(KERN_ERR __FILE__ ": "
99 "lite5200_setup_cpu\n"); 112 "Error while mapping GPIO/INTR during "
113 "lite5200_setup_cpu\n");
100 goto unmap_regs; 114 goto unmap_regs;
101 } 115 }
102 116
103 /* Use internal 48 Mhz */
104 out_8(&cdm->ext_48mhz_en, 0x00);
105 out_8(&cdm->fd_enable, 0x01);
106 if (in_be32(&cdm->rstcfg) & 0x40) /* Assumes 33Mhz clock */
107 out_be16(&cdm->fd_counters, 0x0001);
108 else
109 out_be16(&cdm->fd_counters, 0x5555);
110
111 /* Get port mux config */ 117 /* Get port mux config */
112 port_config = in_be32(&gpio->port_config); 118 port_config = in_be32(&gpio->port_config);
113 119
@@ -118,29 +124,29 @@ lite5200_setup_cpu(void)
118 port_config &= ~0x00007000; /* Differential mode - USB1 only */ 124 port_config &= ~0x00007000; /* Differential mode - USB1 only */
119 port_config |= 0x00001000; 125 port_config |= 0x00001000;
120 126
127 /* ATA CS is on csb_4/5 */
128 port_config &= ~0x03000000;
129 port_config |= 0x01000000;
130
121 /* Commit port config */ 131 /* Commit port config */
122 out_be32(&gpio->port_config, port_config); 132 out_be32(&gpio->port_config, port_config);
123 133
124 /* Configure the XLB Arbiter */ 134 /* IRQ[0-3] setup */
125 out_be32(&xlb->master_pri_enable, 0xff);
126 out_be32(&xlb->master_priority, 0x11111111);
127
128 /* Enable ram snooping for 1GB window */
129 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_SNOOP);
130 out_be32(&xlb->snoop_window, MPC52xx_PCI_TARGET_MEM | 0x1d);
131
132 /* IRQ[0-3] setup : IRQ0 - Level Active Low */
133 /* IRQ[1-3] - Level Active High */
134 intr_ctrl = in_be32(&intr->ctrl); 135 intr_ctrl = in_be32(&intr->ctrl);
135 intr_ctrl &= ~0x00ff0000; 136 intr_ctrl &= ~0x00ff0000;
136 intr_ctrl |= 0x00c00000; 137#ifdef CONFIG_LITE5200B
138 /* IRQ[0-3] Level Active Low */
139 intr_ctrl |= 0x00ff0000;
140#else
141 /* IRQ0 Level Active Low
142 * IRQ[1-3] Level Active High */
143 intr_ctrl |= 0x00c00000;
144#endif
137 out_be32(&intr->ctrl, intr_ctrl); 145 out_be32(&intr->ctrl, intr_ctrl);
138 146
139 /* Unmap reg zone */ 147 /* Unmap reg zone */
140unmap_regs: 148unmap_regs:
141 if (cdm) iounmap(cdm);
142 if (gpio) iounmap(gpio); 149 if (gpio) iounmap(gpio);
143 if (xlb) iounmap(xlb);
144 if (intr) iounmap(intr); 150 if (intr) iounmap(intr);
145} 151}
146 152
@@ -148,7 +154,8 @@ static void __init
148lite5200_setup_arch(void) 154lite5200_setup_arch(void)
149{ 155{
150 /* CPU & Port mux setup */ 156 /* CPU & Port mux setup */
151 lite5200_setup_cpu(); 157 mpc52xx_setup_cpu(); /* Generic */
158 lite5200_setup_cpu(); /* Platform specific */
152 159
153#ifdef CONFIG_PCI 160#ifdef CONFIG_PCI
154 /* PCI Bridge setup */ 161 /* PCI Bridge setup */