aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-12-05 00:13:25 -0500
committerPaul Mackerras <paulus@samba.org>2007-12-05 00:13:25 -0500
commitcc1bf182bb8451a036a7c227f0a95a0416c4736e (patch)
treee41508d28079bc599faf2604b7d9fa4e828f616a
parent44032af0e7d5467b12f998dbf2f1cd23c5324fd5 (diff)
parent5619965fecf5679ea32350905c54d087b27cc8ea (diff)
Merge branch 'for-2.6.25' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/pasemi into for-2.6.25
-rw-r--r--arch/powerpc/platforms/pasemi/Kconfig2
-rw-r--r--arch/powerpc/platforms/pasemi/cpufreq.c19
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c94
-rw-r--r--arch/powerpc/platforms/pasemi/pasemi.h6
-rw-r--r--arch/powerpc/platforms/pasemi/powersave.S11
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c16
-rw-r--r--drivers/char/hw_random/Kconfig2
-rw-r--r--drivers/char/hw_random/pasemi-rng.c7
-rw-r--r--drivers/edac/pasemi_edac.c4
9 files changed, 111 insertions, 50 deletions
diff --git a/arch/powerpc/platforms/pasemi/Kconfig b/arch/powerpc/platforms/pasemi/Kconfig
index 735e1536cbfc..2f4dd6e4aac1 100644
--- a/arch/powerpc/platforms/pasemi/Kconfig
+++ b/arch/powerpc/platforms/pasemi/Kconfig
@@ -17,7 +17,7 @@ config PPC_PASEMI_IOMMU
17 bool "PA Semi IOMMU support" 17 bool "PA Semi IOMMU support"
18 depends on PPC_PASEMI 18 depends on PPC_PASEMI
19 help 19 help
20 IOMMU support for PA6T-1682M 20 IOMMU support for PA Semi PWRficient
21 21
22config PPC_PASEMI_IOMMU_DMA_FORCE 22config PPC_PASEMI_IOMMU_DMA_FORCE
23 bool "Force DMA engine to use IOMMU" 23 bool "Force DMA engine to use IOMMU"
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c
index 1cfb8b0c8fec..58556b028a4c 100644
--- a/arch/powerpc/platforms/pasemi/cpufreq.c
+++ b/arch/powerpc/platforms/pasemi/cpufreq.c
@@ -32,6 +32,7 @@
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/prom.h> 33#include <asm/prom.h>
34#include <asm/time.h> 34#include <asm/time.h>
35#include <asm/smp.h>
35 36
36#define SDCASR_REG 0x0100 37#define SDCASR_REG 0x0100
37#define SDCASR_REG_STRIDE 0x1000 38#define SDCASR_REG_STRIDE 0x1000
@@ -124,6 +125,11 @@ static void set_astate(int cpu, unsigned int astate)
124 local_irq_restore(flags); 125 local_irq_restore(flags);
125} 126}
126 127
128int check_astate(void)
129{
130 return get_cur_astate(hard_smp_processor_id());
131}
132
127void restore_astate(int cpu) 133void restore_astate(int cpu)
128{ 134{
129 set_astate(cpu, current_astate); 135 set_astate(cpu, current_astate);
@@ -147,7 +153,10 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
147 if (!cpu) 153 if (!cpu)
148 goto out; 154 goto out;
149 155
150 dn = of_find_compatible_node(NULL, "sdc", "1682m-sdc"); 156 dn = of_find_compatible_node(NULL, NULL, "1682m-sdc");
157 if (!dn)
158 dn = of_find_compatible_node(NULL, NULL,
159 "pasemi,pwrficient-sdc");
151 if (!dn) 160 if (!dn)
152 goto out; 161 goto out;
153 err = of_address_to_resource(dn, 0, &res); 162 err = of_address_to_resource(dn, 0, &res);
@@ -160,7 +169,10 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
160 goto out; 169 goto out;
161 } 170 }
162 171
163 dn = of_find_compatible_node(NULL, "gizmo", "1682m-gizmo"); 172 dn = of_find_compatible_node(NULL, NULL, "1682m-gizmo");
173 if (!dn)
174 dn = of_find_compatible_node(NULL, NULL,
175 "pasemi,pwrficient-gizmo");
164 if (!dn) { 176 if (!dn) {
165 err = -ENODEV; 177 err = -ENODEV;
166 goto out_unmap_sdcasr; 178 goto out_unmap_sdcasr;
@@ -292,7 +304,8 @@ static struct cpufreq_driver pas_cpufreq_driver = {
292 304
293static int __init pas_cpufreq_init(void) 305static int __init pas_cpufreq_init(void)
294{ 306{
295 if (!machine_is_compatible("PA6T-1682M")) 307 if (!machine_is_compatible("PA6T-1682M") &&
308 !machine_is_compatible("pasemi,pwrficient"))
296 return -ENODEV; 309 return -ENODEV;
297 310
298 return cpufreq_register_driver(&pas_cpufreq_driver); 311 return cpufreq_register_driver(&pas_cpufreq_driver);
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index dae9f658122e..04a8686e6084 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -218,45 +218,27 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
218 const struct of_device_id *match) 218 const struct of_device_id *match)
219{ 219{
220 struct device *dev = &ofdev->dev; 220 struct device *dev = &ofdev->dev;
221 struct device_node *np = ofdev->node; 221 struct device_node *phy_dn, *np = ofdev->node;
222 struct device_node *gpio_np;
223 struct mii_bus *new_bus; 222 struct mii_bus *new_bus;
224 struct resource res;
225 struct gpio_priv *priv; 223 struct gpio_priv *priv;
226 const unsigned int *prop; 224 const unsigned int *prop;
227 int err = 0; 225 int err;
228 int i; 226 int i;
229 227
230 gpio_np = of_find_compatible_node(NULL, "gpio", "1682m-gpio"); 228 err = -ENOMEM;
231
232 if (!gpio_np)
233 return -ENODEV;
234
235 err = of_address_to_resource(gpio_np, 0, &res);
236 of_node_put(gpio_np);
237
238 if (err)
239 return -EINVAL;
240
241 if (!gpio_regs)
242 gpio_regs = ioremap(res.start, 0x100);
243
244 if (!gpio_regs)
245 return -EPERM;
246
247 priv = kzalloc(sizeof(struct gpio_priv), GFP_KERNEL); 229 priv = kzalloc(sizeof(struct gpio_priv), GFP_KERNEL);
248 if (priv == NULL) 230 if (!priv)
249 return -ENOMEM; 231 goto out;
250 232
251 new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); 233 new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL);
252 234
253 if (new_bus == NULL) 235 if (!new_bus)
254 return -ENOMEM; 236 goto out_free_priv;
255 237
256 new_bus->name = "pasemi gpio mdio bus", 238 new_bus->name = "pasemi gpio mdio bus";
257 new_bus->read = &gpio_mdio_read, 239 new_bus->read = &gpio_mdio_read;
258 new_bus->write = &gpio_mdio_write, 240 new_bus->write = &gpio_mdio_write;
259 new_bus->reset = &gpio_mdio_reset, 241 new_bus->reset = &gpio_mdio_reset;
260 242
261 prop = of_get_property(np, "reg", NULL); 243 prop = of_get_property(np, "reg", NULL);
262 new_bus->id = *prop; 244 new_bus->id = *prop;
@@ -265,9 +247,24 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
265 new_bus->phy_mask = 0; 247 new_bus->phy_mask = 0;
266 248
267 new_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); 249 new_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
268 for(i = 0; i < PHY_MAX_ADDR; ++i)
269 new_bus->irq[i] = irq_create_mapping(NULL, 10);
270 250
251 if (!new_bus->irq)
252 goto out_free_bus;
253
254 for (i = 0; i < PHY_MAX_ADDR; i++)
255 new_bus->irq[i] = NO_IRQ;
256
257 for (phy_dn = of_get_next_child(np, NULL);
258 phy_dn != NULL;
259 phy_dn = of_get_next_child(np, phy_dn)) {
260 const unsigned int *ip, *regp;
261
262 ip = of_get_property(phy_dn, "interrupts", NULL);
263 regp = of_get_property(phy_dn, "reg", NULL);
264 if (!ip || !regp || *regp >= PHY_MAX_ADDR)
265 continue;
266 new_bus->irq[*regp] = irq_create_mapping(NULL, *ip);
267 }
271 268
272 prop = of_get_property(np, "mdc-pin", NULL); 269 prop = of_get_property(np, "mdc-pin", NULL);
273 priv->mdc_pin = *prop; 270 priv->mdc_pin = *prop;
@@ -280,17 +277,21 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
280 277
281 err = mdiobus_register(new_bus); 278 err = mdiobus_register(new_bus);
282 279
283 if (0 != err) { 280 if (err != 0) {
284 printk(KERN_ERR "%s: Cannot register as MDIO bus, err %d\n", 281 printk(KERN_ERR "%s: Cannot register as MDIO bus, err %d\n",
285 new_bus->name, err); 282 new_bus->name, err);
286 goto bus_register_fail; 283 goto out_free_irq;
287 } 284 }
288 285
289 return 0; 286 return 0;
290 287
291bus_register_fail: 288out_free_irq:
289 kfree(new_bus->irq);
290out_free_bus:
292 kfree(new_bus); 291 kfree(new_bus);
293 292out_free_priv:
293 kfree(priv);
294out:
294 return err; 295 return err;
295} 296}
296 297
@@ -317,6 +318,7 @@ static struct of_device_id gpio_mdio_match[] =
317 }, 318 },
318 {}, 319 {},
319}; 320};
321MODULE_DEVICE_TABLE(of, gpio_mdio_match);
320 322
321static struct of_platform_driver gpio_mdio_driver = 323static struct of_platform_driver gpio_mdio_driver =
322{ 324{
@@ -330,12 +332,32 @@ static struct of_platform_driver gpio_mdio_driver =
330 332
331int gpio_mdio_init(void) 333int gpio_mdio_init(void)
332{ 334{
335 struct device_node *np;
336
337 np = of_find_compatible_node(NULL, NULL, "1682m-gpio");
338 if (!np)
339 np = of_find_compatible_node(NULL, NULL,
340 "pasemi,pwrficient-gpio");
341 if (!np)
342 return -ENODEV;
343 gpio_regs = of_iomap(np, 0);
344 of_node_put(np);
345
346 if (!gpio_regs)
347 return -ENODEV;
348
333 return of_register_platform_driver(&gpio_mdio_driver); 349 return of_register_platform_driver(&gpio_mdio_driver);
334} 350}
351module_init(gpio_mdio_init);
335 352
336void gpio_mdio_exit(void) 353void gpio_mdio_exit(void)
337{ 354{
338 of_unregister_platform_driver(&gpio_mdio_driver); 355 of_unregister_platform_driver(&gpio_mdio_driver);
356 if (gpio_regs)
357 iounmap(gpio_regs);
339} 358}
340device_initcall(gpio_mdio_init); 359module_exit(gpio_mdio_exit);
341 360
361MODULE_LICENSE("GPL");
362MODULE_AUTHOR("Olof Johansson <olof@lixom.net>");
363MODULE_DESCRIPTION("Driver for MDIO over GPIO on PA Semi PWRficient-based boards");
diff --git a/arch/powerpc/platforms/pasemi/pasemi.h b/arch/powerpc/platforms/pasemi/pasemi.h
index 516acabb4e96..c96127b029b6 100644
--- a/arch/powerpc/platforms/pasemi/pasemi.h
+++ b/arch/powerpc/platforms/pasemi/pasemi.h
@@ -16,8 +16,14 @@ extern void idle_doze(void);
16 16
17/* Restore astate to last set */ 17/* Restore astate to last set */
18#ifdef CONFIG_PPC_PASEMI_CPUFREQ 18#ifdef CONFIG_PPC_PASEMI_CPUFREQ
19extern int check_astate(void);
19extern void restore_astate(int cpu); 20extern void restore_astate(int cpu);
20#else 21#else
22static inline int check_astate(void)
23{
24 /* Always return >0 so we never power save */
25 return 1;
26}
21static inline void restore_astate(int cpu) 27static inline void restore_astate(int cpu)
22{ 28{
23} 29}
diff --git a/arch/powerpc/platforms/pasemi/powersave.S b/arch/powerpc/platforms/pasemi/powersave.S
index 6d0fba6aab17..56f45adcd089 100644
--- a/arch/powerpc/platforms/pasemi/powersave.S
+++ b/arch/powerpc/platforms/pasemi/powersave.S
@@ -62,7 +62,16 @@ sleep_common:
62 mflr r0 62 mflr r0
63 std r0, 16(r1) 63 std r0, 16(r1)
64 stdu r1,-64(r1) 64 stdu r1,-64(r1)
65#ifdef CONFIG_PPC_PASEMI_CPUFREQ
66 std r3, 48(r1)
65 67
68 /* Only do power savings when in astate 0 */
69 bl .check_astate
70 cmpwi r3,0
71 bne 1f
72
73 ld r3, 48(r1)
74#endif
66 LOAD_REG_IMMEDIATE(r6,MSR_DR|MSR_IR|MSR_ME|MSR_EE) 75 LOAD_REG_IMMEDIATE(r6,MSR_DR|MSR_IR|MSR_ME|MSR_EE)
67 mfmsr r4 76 mfmsr r4
68 andc r5,r4,r6 77 andc r5,r4,r6
@@ -73,7 +82,7 @@ sleep_common:
73 82
74 mtmsrd r4,0 83 mtmsrd r4,0
75 84
76 addi r1,r1,64 851: addi r1,r1,64
77 ld r0,16(r1) 86 ld r0,16(r1)
78 mtlr r0 87 mtlr r0
79 blr 88 blr
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 3d62060498b4..2b638659d1ea 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -43,6 +43,10 @@
43 43
44#include "pasemi.h" 44#include "pasemi.h"
45 45
46#if !defined(CONFIG_SMP)
47static void smp_send_stop(void) {}
48#endif
49
46/* SDC reset register, must be pre-mapped at reset time */ 50/* SDC reset register, must be pre-mapped at reset time */
47static void __iomem *reset_reg; 51static void __iomem *reset_reg;
48 52
@@ -60,6 +64,9 @@ static int num_mce_regs;
60 64
61static void pas_restart(char *cmd) 65static void pas_restart(char *cmd)
62{ 66{
67 /* Need to put others cpu in hold loop so they're not sleeping */
68 smp_send_stop();
69 udelay(10000);
63 printk("Restarting...\n"); 70 printk("Restarting...\n");
64 while (1) 71 while (1)
65 out_le32(reset_reg, 0x6000000); 72 out_le32(reset_reg, 0x6000000);
@@ -362,8 +369,12 @@ static inline void pasemi_pcmcia_init(void)
362 369
363 370
364static struct of_device_id pasemi_bus_ids[] = { 371static struct of_device_id pasemi_bus_ids[] = {
372 /* Unfortunately needed for legacy firmwares */
365 { .type = "localbus", }, 373 { .type = "localbus", },
366 { .type = "sdc", }, 374 { .type = "sdc", },
375 /* These are the proper entries, which newer firmware uses */
376 { .compatible = "pasemi,localbus", },
377 { .compatible = "pasemi,sdc", },
367 {}, 378 {},
368}; 379};
369 380
@@ -389,7 +400,8 @@ static int __init pas_probe(void)
389{ 400{
390 unsigned long root = of_get_flat_dt_root(); 401 unsigned long root = of_get_flat_dt_root();
391 402
392 if (!of_flat_dt_is_compatible(root, "PA6T-1682M")) 403 if (!of_flat_dt_is_compatible(root, "PA6T-1682M") &&
404 !of_flat_dt_is_compatible(root, "pasemi,pwrficient"))
393 return 0; 405 return 0;
394 406
395 hpte_init_native(); 407 hpte_init_native();
@@ -400,7 +412,7 @@ static int __init pas_probe(void)
400} 412}
401 413
402define_machine(pasemi) { 414define_machine(pasemi) {
403 .name = "PA Semi PA6T-1682M", 415 .name = "PA Semi PWRficient",
404 .probe = pas_probe, 416 .probe = pas_probe,
405 .setup_arch = pas_setup_arch, 417 .setup_arch = pas_setup_arch,
406 .init_early = pas_init_early, 418 .init_early = pas_init_early,
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index 2d7cd486e025..6bbd4fa50f3b 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -98,7 +98,7 @@ config HW_RANDOM_PASEMI
98 default HW_RANDOM 98 default HW_RANDOM
99 ---help--- 99 ---help---
100 This driver provides kernel-side support for the Random Number 100 This driver provides kernel-side support for the Random Number
101 Generator hardware found on PA6T-1682M processor. 101 Generator hardware found on PA Semi PWRficient SoCs.
102 102
103 To compile this driver as a module, choose M here: the 103 To compile this driver as a module, choose M here: the
104 module will be called pasemi-rng. 104 module will be called pasemi-rng.
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
index fa6040b6c8f2..24ae3073991f 100644
--- a/drivers/char/hw_random/pasemi-rng.c
+++ b/drivers/char/hw_random/pasemi-rng.c
@@ -126,10 +126,9 @@ static int __devexit rng_remove(struct of_device *dev)
126} 126}
127 127
128static struct of_device_id rng_match[] = { 128static struct of_device_id rng_match[] = {
129 { 129 { .compatible = "1682m-rng", },
130 .compatible = "1682m-rng", 130 { .compatible = "pasemi,pwrficient-rng", },
131 }, 131 { },
132 {},
133}; 132};
134 133
135static struct of_platform_driver rng_driver = { 134static struct of_platform_driver rng_driver = {
diff --git a/drivers/edac/pasemi_edac.c b/drivers/edac/pasemi_edac.c
index 9007d0677220..90320917be28 100644
--- a/drivers/edac/pasemi_edac.c
+++ b/drivers/edac/pasemi_edac.c
@@ -225,7 +225,7 @@ static int __devinit pasemi_edac_probe(struct pci_dev *pdev,
225 EDAC_FLAG_NONE; 225 EDAC_FLAG_NONE;
226 mci->mod_name = MODULE_NAME; 226 mci->mod_name = MODULE_NAME;
227 mci->dev_name = pci_name(pdev); 227 mci->dev_name = pci_name(pdev);
228 mci->ctl_name = "pasemi,1682m-mc"; 228 mci->ctl_name = "pasemi,pwrficient-mc";
229 mci->edac_check = pasemi_edac_check; 229 mci->edac_check = pasemi_edac_check;
230 mci->ctl_page_to_phys = NULL; 230 mci->ctl_page_to_phys = NULL;
231 pci_read_config_dword(pdev, MCCFG_SCRUB, &scrub); 231 pci_read_config_dword(pdev, MCCFG_SCRUB, &scrub);
@@ -297,4 +297,4 @@ module_exit(pasemi_edac_exit);
297 297
298MODULE_LICENSE("GPL"); 298MODULE_LICENSE("GPL");
299MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>"); 299MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>");
300MODULE_DESCRIPTION("MC support for PA Semi PA6T-1682M memory controller"); 300MODULE_DESCRIPTION("MC support for PA Semi PWRficient memory controller");