aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorDmitri Vorobiev <dmitri.vorobiev@gmail.com>2008-01-24 11:52:43 -0500
committerRalf Baechle <ralf@linux-mips.org>2008-01-29 05:15:03 -0500
commitf3a4ce9587cd1e810f31c87ecb89033d5fd269ce (patch)
treeb5ad7575c85be022c4c9cbd7d398997d408fcb56 /arch/mips
parent8216d348e374b369338f015ca34492de1e381214 (diff)
[MIPS] Malta: check the PCI clock frequency in a separate function
This patch adds a separate short and sweet function to check the PCI clock frequency. This is to improve readability of the Malta setup code. Along the way, a couple of coding style violations are fixed. No functional changes introduced. Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@gmail.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
index d051405a2809..79d74ea75bc4 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -108,6 +108,30 @@ void __init fd_activate(void)
108} 108}
109#endif 109#endif
110 110
111#ifdef CONFIG_BLK_DEV_IDE
112static void __init pci_clock_check(void)
113{
114 unsigned int __iomem *jmpr_p =
115 (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
116 int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
117 static const int pciclocks[] __initdata = {
118 33, 20, 25, 30, 12, 16, 37, 10
119 };
120 int pciclock = pciclocks[jmpr];
121 char *argptr = prom_getcmdline();
122
123 if (pciclock != 33 && !strstr(argptr, "idebus=")) {
124 printk(KERN_WARNING "WARNING: PCI clock is %dMHz, "
125 "setting idebus\n", pciclock);
126 argptr += strlen(argptr);
127 sprintf(argptr, " idebus=%d", pciclock);
128 if (pciclock < 20 || pciclock > 66)
129 printk(KERN_WARNING "WARNING: IDE timing "
130 "calculations will be incorrect\n");
131 }
132}
133#endif
134
111void __init plat_mem_setup(void) 135void __init plat_mem_setup(void)
112{ 136{
113 unsigned int i; 137 unsigned int i;
@@ -171,24 +195,7 @@ void __init plat_mem_setup(void)
171#endif 195#endif
172 196
173#ifdef CONFIG_BLK_DEV_IDE 197#ifdef CONFIG_BLK_DEV_IDE
174 /* Check PCI clock */ 198 pci_clock_check();
175 {
176 unsigned int __iomem *jmpr_p = (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
177 int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
178 static const int pciclocks[] __initdata = {
179 33, 20, 25, 30, 12, 16, 37, 10
180 };
181 int pciclock = pciclocks[jmpr];
182 char *argptr = prom_getcmdline();
183
184 if (pciclock != 33 && !strstr (argptr, "idebus=")) {
185 printk("WARNING: PCI clock is %dMHz, setting idebus\n", pciclock);
186 argptr += strlen(argptr);
187 sprintf(argptr, " idebus=%d", pciclock);
188 if (pciclock < 20 || pciclock > 66)
189 printk("WARNING: IDE timing calculations will be incorrect\n");
190 }
191 }
192#endif 199#endif
193#ifdef CONFIG_BLK_DEV_FD 200#ifdef CONFIG_BLK_DEV_FD
194 fd_activate(); 201 fd_activate();