diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2007-02-17 11:18:34 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-02-17 11:18:34 -0500 |
commit | 975b89399679dcf8587288d46d3f21d4286af167 (patch) | |
tree | 5e634b6d99313865fb47e9f6f3408d25b47f1098 /arch/powerpc | |
parent | 578f8f20f3c7e2c18083cf3bd434df994280af30 (diff) | |
parent | fc7900bb04c4290f3a8e43abf231aee566feff6d (diff) |
Merge branch 'master' into 85xx
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/configs/ppc64_defconfig | 4 | ||||
-rw-r--r-- | arch/powerpc/configs/pseries_defconfig | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom_parse.c | 40 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/power.c | 87 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/pseries.h | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 30 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 19 |
8 files changed, 171 insertions, 18 deletions
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index debac66e8258..a8da0aea3b87 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig | |||
@@ -500,7 +500,7 @@ CONFIG_BLK_DEV_AMD74XX=y | |||
500 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set | 500 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set |
501 | # CONFIG_BLK_DEV_SVWKS is not set | 501 | # CONFIG_BLK_DEV_SVWKS is not set |
502 | # CONFIG_BLK_DEV_SIIMAGE is not set | 502 | # CONFIG_BLK_DEV_SIIMAGE is not set |
503 | CONFIG_BLK_DEV_SL82C105=y | 503 | # CONFIG_BLK_DEV_SL82C105 is not set |
504 | # CONFIG_BLK_DEV_SLC90E66 is not set | 504 | # CONFIG_BLK_DEV_SLC90E66 is not set |
505 | # CONFIG_BLK_DEV_TRM290 is not set | 505 | # CONFIG_BLK_DEV_TRM290 is not set |
506 | # CONFIG_BLK_DEV_VIA82CXXX is not set | 506 | # CONFIG_BLK_DEV_VIA82CXXX is not set |
@@ -646,7 +646,7 @@ CONFIG_SATA_SVW=y | |||
646 | # CONFIG_PATA_SIL680 is not set | 646 | # CONFIG_PATA_SIL680 is not set |
647 | # CONFIG_PATA_SIS is not set | 647 | # CONFIG_PATA_SIS is not set |
648 | # CONFIG_PATA_VIA is not set | 648 | # CONFIG_PATA_VIA is not set |
649 | # CONFIG_PATA_WINBOND is not set | 649 | CONFIG_PATA_WINBOND=y |
650 | 650 | ||
651 | # | 651 | # |
652 | # Multi-device support (RAID and LVM) | 652 | # Multi-device support (RAID and LVM) |
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index 1c794fe718fd..6e96e50c362d 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig | |||
@@ -483,7 +483,7 @@ CONFIG_BLK_DEV_AMD74XX=y | |||
483 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set | 483 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set |
484 | # CONFIG_BLK_DEV_SVWKS is not set | 484 | # CONFIG_BLK_DEV_SVWKS is not set |
485 | # CONFIG_BLK_DEV_SIIMAGE is not set | 485 | # CONFIG_BLK_DEV_SIIMAGE is not set |
486 | CONFIG_BLK_DEV_SL82C105=y | 486 | # CONFIG_BLK_DEV_SL82C105 is not set |
487 | # CONFIG_BLK_DEV_SLC90E66 is not set | 487 | # CONFIG_BLK_DEV_SLC90E66 is not set |
488 | # CONFIG_BLK_DEV_TRM290 is not set | 488 | # CONFIG_BLK_DEV_TRM290 is not set |
489 | # CONFIG_BLK_DEV_VIA82CXXX is not set | 489 | # CONFIG_BLK_DEV_VIA82CXXX is not set |
@@ -628,7 +628,7 @@ CONFIG_ATA=y | |||
628 | # CONFIG_PATA_SIL680 is not set | 628 | # CONFIG_PATA_SIL680 is not set |
629 | # CONFIG_PATA_SIS is not set | 629 | # CONFIG_PATA_SIS is not set |
630 | # CONFIG_PATA_VIA is not set | 630 | # CONFIG_PATA_VIA is not set |
631 | # CONFIG_PATA_WINBOND is not set | 631 | CONFIG_PATA_WINBOND=y |
632 | 632 | ||
633 | # | 633 | # |
634 | # Multi-device support (RAID and LVM) | 634 | # Multi-device support (RAID and LVM) |
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index 12c51e4ad2b4..ea6fd552c7ea 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/pci_regs.h> | 5 | #include <linux/pci_regs.h> |
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | #include <linux/ioport.h> | 7 | #include <linux/ioport.h> |
8 | #include <linux/etherdevice.h> | ||
8 | #include <asm/prom.h> | 9 | #include <asm/prom.h> |
9 | #include <asm/pci-bridge.h> | 10 | #include <asm/pci-bridge.h> |
10 | 11 | ||
@@ -1003,3 +1004,42 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq | |||
1003 | return res; | 1004 | return res; |
1004 | } | 1005 | } |
1005 | EXPORT_SYMBOL_GPL(of_irq_map_one); | 1006 | EXPORT_SYMBOL_GPL(of_irq_map_one); |
1007 | |||
1008 | /** | ||
1009 | * Search the device tree for the best MAC address to use. 'mac-address' is | ||
1010 | * checked first, because that is supposed to contain to "most recent" MAC | ||
1011 | * address. If that isn't set, then 'local-mac-address' is checked next, | ||
1012 | * because that is the default address. If that isn't set, then the obsolete | ||
1013 | * 'address' is checked, just in case we're using an old device tree. | ||
1014 | * | ||
1015 | * Note that the 'address' property is supposed to contain a virtual address of | ||
1016 | * the register set, but some DTS files have redefined that property to be the | ||
1017 | * MAC address. | ||
1018 | * | ||
1019 | * All-zero MAC addresses are rejected, because those could be properties that | ||
1020 | * exist in the device tree, but were not set by U-Boot. For example, the | ||
1021 | * DTS could define 'mac-address' and 'local-mac-address', with zero MAC | ||
1022 | * addresses. Some older U-Boots only initialized 'local-mac-address'. In | ||
1023 | * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists | ||
1024 | * but is all zeros. | ||
1025 | */ | ||
1026 | const void *of_get_mac_address(struct device_node *np) | ||
1027 | { | ||
1028 | struct property *pp; | ||
1029 | |||
1030 | pp = of_find_property(np, "mac-address", NULL); | ||
1031 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
1032 | return pp->value; | ||
1033 | |||
1034 | pp = of_find_property(np, "local-mac-address", NULL); | ||
1035 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
1036 | return pp->value; | ||
1037 | |||
1038 | pp = of_find_property(np, "address", NULL); | ||
1039 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
1040 | return pp->value; | ||
1041 | |||
1042 | return NULL; | ||
1043 | } | ||
1044 | EXPORT_SYMBOL(of_get_mac_address); | ||
1045 | |||
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index dc0583bdbc63..2dfd05095a25 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile | |||
@@ -4,7 +4,7 @@ endif | |||
4 | 4 | ||
5 | obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ | 5 | obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ |
6 | setup.o iommu.o ras.o rtasd.o pci_dlpar.o \ | 6 | setup.o iommu.o ras.o rtasd.o pci_dlpar.o \ |
7 | firmware.o | 7 | firmware.o power.o |
8 | obj-$(CONFIG_SMP) += smp.o | 8 | obj-$(CONFIG_SMP) += smp.o |
9 | obj-$(CONFIG_XICS) += xics.o | 9 | obj-$(CONFIG_XICS) += xics.o |
10 | obj-$(CONFIG_SCANLOG) += scanlog.o | 10 | obj-$(CONFIG_SCANLOG) += scanlog.o |
diff --git a/arch/powerpc/platforms/pseries/power.c b/arch/powerpc/platforms/pseries/power.c new file mode 100644 index 000000000000..2624b71df73d --- /dev/null +++ b/arch/powerpc/platforms/pseries/power.c | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * Interface for power-management for ppc64 compliant platform | ||
3 | * | ||
4 | * Manish Ahuja <mahuja@us.ibm.com> | ||
5 | * | ||
6 | * Feb 2007 | ||
7 | * | ||
8 | * Copyright (C) 2007 IBM Corporation. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; version 2 of the License. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/kobject.h> | ||
25 | #include <linux/string.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/init.h> | ||
28 | |||
29 | unsigned long rtas_poweron_auto; /* default and normal state is 0 */ | ||
30 | |||
31 | static ssize_t auto_poweron_show(struct subsystem *subsys, char *buf) | ||
32 | { | ||
33 | return sprintf(buf, "%lu\n", rtas_poweron_auto); | ||
34 | } | ||
35 | |||
36 | static ssize_t | ||
37 | auto_poweron_store(struct subsystem *subsys, const char *buf, size_t n) | ||
38 | { | ||
39 | int ret; | ||
40 | unsigned long ups_restart; | ||
41 | ret = sscanf(buf, "%lu", &ups_restart); | ||
42 | |||
43 | if ((ret == 1) && ((ups_restart == 1) || (ups_restart == 0))){ | ||
44 | rtas_poweron_auto = ups_restart; | ||
45 | return n; | ||
46 | } | ||
47 | return -EINVAL; | ||
48 | } | ||
49 | |||
50 | static struct subsys_attribute auto_poweron_attr = { | ||
51 | .attr = { | ||
52 | .name = __stringify(auto_poweron), | ||
53 | .mode = 0644, | ||
54 | }, | ||
55 | .show = auto_poweron_show, | ||
56 | .store = auto_poweron_store, | ||
57 | }; | ||
58 | |||
59 | #ifndef CONFIG_PM | ||
60 | decl_subsys(power,NULL,NULL); | ||
61 | |||
62 | static struct attribute *g[] = { | ||
63 | &auto_poweron_attr.attr, | ||
64 | NULL, | ||
65 | }; | ||
66 | |||
67 | static struct attribute_group attr_group = { | ||
68 | .attrs = g, | ||
69 | }; | ||
70 | |||
71 | static int __init pm_init(void) | ||
72 | { | ||
73 | int error = subsystem_register(&power_subsys); | ||
74 | if (!error) | ||
75 | error = sysfs_create_group(&power_subsys.kset.kobj,&attr_group); | ||
76 | return error; | ||
77 | } | ||
78 | core_initcall(pm_init); | ||
79 | #else | ||
80 | extern struct subsystem power_subsys; | ||
81 | |||
82 | static int __init apo_pm_init(void) | ||
83 | { | ||
84 | return (subsys_create_file(&power_subsys, &auto_poweron_attr)); | ||
85 | } | ||
86 | __initcall(apo_pm_init); | ||
87 | #endif | ||
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h index 35264f9af0ff..22bc01989749 100644 --- a/arch/powerpc/platforms/pseries/pseries.h +++ b/arch/powerpc/platforms/pseries/pseries.h | |||
@@ -33,4 +33,7 @@ static inline void setup_kexec_cpu_down_xics(void) { } | |||
33 | static inline void setup_kexec_cpu_down_mpic(void) { } | 33 | static inline void setup_kexec_cpu_down_mpic(void) { } |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | /* Poweron flag used for enabling auto ups restart */ | ||
37 | extern unsigned long rtas_poweron_auto; | ||
38 | |||
36 | #endif /* _PSERIES_PSERIES_H */ | 39 | #endif /* _PSERIES_PSERIES_H */ |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 435a04596526..34aff47b1f55 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -486,6 +486,34 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus) | |||
486 | return PCI_PROBE_NORMAL; | 486 | return PCI_PROBE_NORMAL; |
487 | } | 487 | } |
488 | 488 | ||
489 | /** | ||
490 | * pSeries_power_off - tell firmware about how to power off the system. | ||
491 | * | ||
492 | * This function calls either the power-off rtas token in normal cases | ||
493 | * or the ibm,power-off-ups token (if present & requested) in case of | ||
494 | * a power failure. If power-off token is used, power on will only be | ||
495 | * possible with power button press. If ibm,power-off-ups token is used | ||
496 | * it will allow auto poweron after power is restored. | ||
497 | */ | ||
498 | void pSeries_power_off(void) | ||
499 | { | ||
500 | int rc; | ||
501 | int rtas_poweroff_ups_token = rtas_token("ibm,power-off-ups"); | ||
502 | |||
503 | if (rtas_flash_term_hook) | ||
504 | rtas_flash_term_hook(SYS_POWER_OFF); | ||
505 | |||
506 | if (rtas_poweron_auto == 0 || | ||
507 | rtas_poweroff_ups_token == RTAS_UNKNOWN_SERVICE) { | ||
508 | rc = rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1); | ||
509 | printk(KERN_INFO "RTAS power-off returned %d\n", rc); | ||
510 | } else { | ||
511 | rc = rtas_call(rtas_poweroff_ups_token, 0, 1, NULL); | ||
512 | printk(KERN_INFO "RTAS ibm,power-off-ups returned %d\n", rc); | ||
513 | } | ||
514 | for (;;); | ||
515 | } | ||
516 | |||
489 | define_machine(pseries) { | 517 | define_machine(pseries) { |
490 | .name = "pSeries", | 518 | .name = "pSeries", |
491 | .probe = pSeries_probe, | 519 | .probe = pSeries_probe, |
@@ -496,7 +524,7 @@ define_machine(pseries) { | |||
496 | .pcibios_fixup = pSeries_final_fixup, | 524 | .pcibios_fixup = pSeries_final_fixup, |
497 | .pci_probe_mode = pSeries_pci_probe_mode, | 525 | .pci_probe_mode = pSeries_pci_probe_mode, |
498 | .restart = rtas_restart, | 526 | .restart = rtas_restart, |
499 | .power_off = rtas_power_off, | 527 | .power_off = pSeries_power_off, |
500 | .halt = rtas_halt, | 528 | .halt = rtas_halt, |
501 | .panic = rtas_os_term, | 529 | .panic = rtas_os_term, |
502 | .get_boot_time = rtas_get_boot_time, | 530 | .get_boot_time = rtas_get_boot_time, |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 34161bc5a02f..d20f02927f72 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -233,14 +233,7 @@ static int __init gfar_of_init(void) | |||
233 | goto err; | 233 | goto err; |
234 | } | 234 | } |
235 | 235 | ||
236 | mac_addr = get_property(np, "local-mac-address", NULL); | 236 | mac_addr = of_get_mac_address(np); |
237 | if (mac_addr == NULL) | ||
238 | mac_addr = get_property(np, "mac-address", NULL); | ||
239 | if (mac_addr == NULL) { | ||
240 | /* Obsolete */ | ||
241 | mac_addr = get_property(np, "address", NULL); | ||
242 | } | ||
243 | |||
244 | if (mac_addr) | 237 | if (mac_addr) |
245 | memcpy(gfar_data.mac_addr, mac_addr, 6); | 238 | memcpy(gfar_data.mac_addr, mac_addr, 6); |
246 | 239 | ||
@@ -646,8 +639,9 @@ static int __init fs_enet_of_init(void) | |||
646 | goto unreg; | 639 | goto unreg; |
647 | } | 640 | } |
648 | 641 | ||
649 | mac_addr = get_property(np, "mac-address", NULL); | 642 | mac_addr = of_get_mac_address(np); |
650 | memcpy(fs_enet_data.macaddr, mac_addr, 6); | 643 | if (mac_addr) |
644 | memcpy(fs_enet_data.macaddr, mac_addr, 6); | ||
651 | 645 | ||
652 | ph = get_property(np, "phy-handle", NULL); | 646 | ph = get_property(np, "phy-handle", NULL); |
653 | phy = of_find_node_by_phandle(*ph); | 647 | phy = of_find_node_by_phandle(*ph); |
@@ -931,8 +925,9 @@ static int __init fs_enet_of_init(void) | |||
931 | goto err; | 925 | goto err; |
932 | r[0].name = enet_regs; | 926 | r[0].name = enet_regs; |
933 | 927 | ||
934 | mac_addr = (void *)get_property(np, "mac-address", NULL); | 928 | mac_addr = of_get_mac_address(np); |
935 | memcpy(fs_enet_data.macaddr, mac_addr, 6); | 929 | if (mac_addr) |
930 | memcpy(fs_enet_data.macaddr, mac_addr, 6); | ||
936 | 931 | ||
937 | ph = (phandle *) get_property(np, "phy-handle", NULL); | 932 | ph = (phandle *) get_property(np, "phy-handle", NULL); |
938 | if (ph != NULL) | 933 | if (ph != NULL) |