diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/52xx/lite5200.c | 59 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/mpc52xx_common.c | 35 |
2 files changed, 61 insertions, 33 deletions
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c index 7fa0ec8d91cc..0caa3d955c3b 100644 --- a/arch/powerpc/platforms/52xx/lite5200.c +++ b/arch/powerpc/platforms/52xx/lite5200.c | |||
@@ -30,19 +30,56 @@ | |||
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | 32 | ||
33 | /* | ||
34 | * Fix clock configuration. | ||
35 | * | ||
36 | * Firmware is supposed to be responsible for this. If you are creating a | ||
37 | * new board port, do *NOT* duplicate this code. Fix your boot firmware | ||
38 | * to set it correctly in the first place | ||
39 | */ | ||
40 | static void __init | ||
41 | lite5200_fix_clock_config(void) | ||
42 | { | ||
43 | struct mpc52xx_cdm __iomem *cdm; | ||
44 | |||
45 | /* Map zones */ | ||
46 | cdm = mpc52xx_find_and_map("mpc5200-cdm"); | ||
47 | if (!cdm) { | ||
48 | printk(KERN_ERR "%s() failed; expect abnormal behaviour\n", | ||
49 | __FUNCTION__); | ||
50 | return; | ||
51 | } | ||
52 | |||
53 | /* Use internal 48 Mhz */ | ||
54 | out_8(&cdm->ext_48mhz_en, 0x00); | ||
55 | out_8(&cdm->fd_enable, 0x01); | ||
56 | if (in_be32(&cdm->rstcfg) & 0x40) /* Assumes 33Mhz clock */ | ||
57 | out_be16(&cdm->fd_counters, 0x0001); | ||
58 | else | ||
59 | out_be16(&cdm->fd_counters, 0x5555); | ||
60 | |||
61 | /* Unmap the regs */ | ||
62 | iounmap(cdm); | ||
63 | } | ||
64 | |||
65 | /* | ||
66 | * Fix setting of port_config register. | ||
67 | * | ||
68 | * Firmware is supposed to be responsible for this. If you are creating a | ||
69 | * new board port, do *NOT* duplicate this code. Fix your boot firmware | ||
70 | * to set it correctly in the first place | ||
71 | */ | ||
33 | static void __init | 72 | static void __init |
34 | lite5200_setup_cpu(void) | 73 | lite5200_fix_port_config(void) |
35 | { | 74 | { |
36 | struct mpc52xx_gpio __iomem *gpio; | 75 | struct mpc52xx_gpio __iomem *gpio; |
37 | u32 port_config; | 76 | u32 port_config; |
38 | 77 | ||
39 | /* Map zones */ | ||
40 | gpio = mpc52xx_find_and_map("mpc5200-gpio"); | 78 | gpio = mpc52xx_find_and_map("mpc5200-gpio"); |
41 | if (!gpio) { | 79 | if (!gpio) { |
42 | printk(KERN_ERR __FILE__ ": " | 80 | printk(KERN_ERR "%s() failed. expect abnormal behavior\n", |
43 | "Error while mapping GPIO register for port config. " | 81 | __FUNCTION__); |
44 | "Expect some abnormal behavior\n"); | 82 | return; |
45 | goto error; | ||
46 | } | 83 | } |
47 | 84 | ||
48 | /* Set port config */ | 85 | /* Set port config */ |
@@ -61,7 +98,6 @@ lite5200_setup_cpu(void) | |||
61 | out_be32(&gpio->port_config, port_config); | 98 | out_be32(&gpio->port_config, port_config); |
62 | 99 | ||
63 | /* Unmap zone */ | 100 | /* Unmap zone */ |
64 | error: | ||
65 | iounmap(gpio); | 101 | iounmap(gpio); |
66 | } | 102 | } |
67 | 103 | ||
@@ -100,9 +136,12 @@ static void __init lite5200_setup_arch(void) | |||
100 | if (ppc_md.progress) | 136 | if (ppc_md.progress) |
101 | ppc_md.progress("lite5200_setup_arch()", 0); | 137 | ppc_md.progress("lite5200_setup_arch()", 0); |
102 | 138 | ||
103 | /* CPU & Port mux setup */ | 139 | /* Fix things that firmware should have done. */ |
104 | mpc52xx_setup_cpu(); /* Generic */ | 140 | lite5200_fix_clock_config(); |
105 | lite5200_setup_cpu(); /* Platorm specific */ | 141 | lite5200_fix_port_config(); |
142 | |||
143 | /* Some mpc5200 & mpc5200b related configuration */ | ||
144 | mpc5200_setup_xlb_arbiter(); | ||
106 | 145 | ||
107 | #ifdef CONFIG_PM | 146 | #ifdef CONFIG_PM |
108 | mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare; | 147 | mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare; |
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c index 3eeb6c62e0ff..3bc201e07e6b 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_common.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c | |||
@@ -75,44 +75,33 @@ mpc52xx_find_ipb_freq(struct device_node *node) | |||
75 | EXPORT_SYMBOL(mpc52xx_find_ipb_freq); | 75 | EXPORT_SYMBOL(mpc52xx_find_ipb_freq); |
76 | 76 | ||
77 | 77 | ||
78 | /* | ||
79 | * Configure the XLB arbiter settings to match what Linux expects. | ||
80 | */ | ||
78 | void __init | 81 | void __init |
79 | mpc52xx_setup_cpu(void) | 82 | mpc5200_setup_xlb_arbiter(void) |
80 | { | 83 | { |
81 | struct mpc52xx_cdm __iomem *cdm; | ||
82 | struct mpc52xx_xlb __iomem *xlb; | 84 | struct mpc52xx_xlb __iomem *xlb; |
83 | 85 | ||
84 | /* Map zones */ | ||
85 | cdm = mpc52xx_find_and_map("mpc5200-cdm"); | ||
86 | xlb = mpc52xx_find_and_map("mpc5200-xlb"); | 86 | xlb = mpc52xx_find_and_map("mpc5200-xlb"); |
87 | 87 | if (!xlb) { | |
88 | if (!cdm || !xlb) { | ||
89 | printk(KERN_ERR __FILE__ ": " | 88 | printk(KERN_ERR __FILE__ ": " |
90 | "Error while mapping CDM/XLB during mpc52xx_setup_cpu. " | 89 | "Error mapping XLB in mpc52xx_setup_cpu(). " |
91 | "Expect some abnormal behavior\n"); | 90 | "Expect some abnormal behavior\n"); |
92 | goto unmap_regs; | 91 | return; |
93 | } | 92 | } |
94 | 93 | ||
95 | /* Use internal 48 Mhz */ | ||
96 | out_8(&cdm->ext_48mhz_en, 0x00); | ||
97 | out_8(&cdm->fd_enable, 0x01); | ||
98 | if (in_be32(&cdm->rstcfg) & 0x40) /* Assumes 33Mhz clock */ | ||
99 | out_be16(&cdm->fd_counters, 0x0001); | ||
100 | else | ||
101 | out_be16(&cdm->fd_counters, 0x5555); | ||
102 | |||
103 | /* Configure the XLB Arbiter priorities */ | 94 | /* Configure the XLB Arbiter priorities */ |
104 | out_be32(&xlb->master_pri_enable, 0xff); | 95 | out_be32(&xlb->master_pri_enable, 0xff); |
105 | out_be32(&xlb->master_priority, 0x11111111); | 96 | out_be32(&xlb->master_priority, 0x11111111); |
106 | 97 | ||
107 | /* Disable XLB pipelining */ | 98 | /* Disable XLB pipelining |
108 | /* (cfr errate 292. We could do this only just before ATA PIO | 99 | * (cfr errate 292. We could do this only just before ATA PIO |
109 | transaction and re-enable it afterwards ...) */ | 100 | * transaction and re-enable it afterwards ...) |
101 | */ | ||
110 | out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS); | 102 | out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS); |
111 | 103 | ||
112 | /* Unmap zones */ | 104 | iounmap(xlb); |
113 | unmap_regs: | ||
114 | if (cdm) iounmap(cdm); | ||
115 | if (xlb) iounmap(xlb); | ||
116 | } | 105 | } |
117 | 106 | ||
118 | void __init | 107 | void __init |