diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-09-23 00:44:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-23 01:17:35 -0400 |
commit | 0365ba7fb1fa94a41289d6a3d36b4d95960e56cc (patch) | |
tree | 1da4b5fb97266849d86a78010141e7345cc599aa /arch | |
parent | 0f329075fb1dbd6845db03e9bb8252024fdbea1f (diff) |
[PATCH] ppc64: SMU driver update & i2c support
The SMU is the "system controller" chip used by Apple recent G5 machines
including the iMac G5. It drives things like fans, i2c busses, real time
clock, etc...
The current kernel contains a very crude driver that doesn't do much more
than reading the real time clock synchronously. This is a completely
rewritten driver that provides interrupt based command queuing, a userland
interface, and an i2c/smbus driver for accessing the devices hanging off
the SMU i2c busses like temperature sensors. This driver is a basic block
for upcoming work on thermal control for those machines, among others.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ppc/platforms/pmac_setup.c | 10 | ||||
-rw-r--r-- | arch/ppc/syslib/of_device.c | 6 | ||||
-rw-r--r-- | arch/ppc64/kernel/of_device.c | 7 | ||||
-rw-r--r-- | arch/ppc64/kernel/pmac_setup.c | 18 | ||||
-rw-r--r-- | arch/ppc64/kernel/pmac_time.c | 4 |
5 files changed, 30 insertions, 15 deletions
diff --git a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c index b392b9a15987..4c56a4734aec 100644 --- a/arch/ppc/platforms/pmac_setup.c +++ b/arch/ppc/platforms/pmac_setup.c | |||
@@ -719,7 +719,8 @@ pmac_declare_of_platform_devices(void) | |||
719 | if (np) { | 719 | if (np) { |
720 | for (np = np->child; np != NULL; np = np->sibling) | 720 | for (np = np->child; np != NULL; np = np->sibling) |
721 | if (strncmp(np->name, "i2c", 3) == 0) { | 721 | if (strncmp(np->name, "i2c", 3) == 0) { |
722 | of_platform_device_create(np, "uni-n-i2c"); | 722 | of_platform_device_create(np, "uni-n-i2c", |
723 | NULL); | ||
723 | break; | 724 | break; |
724 | } | 725 | } |
725 | } | 726 | } |
@@ -727,17 +728,18 @@ pmac_declare_of_platform_devices(void) | |||
727 | if (np) { | 728 | if (np) { |
728 | for (np = np->child; np != NULL; np = np->sibling) | 729 | for (np = np->child; np != NULL; np = np->sibling) |
729 | if (strncmp(np->name, "i2c", 3) == 0) { | 730 | if (strncmp(np->name, "i2c", 3) == 0) { |
730 | of_platform_device_create(np, "u3-i2c"); | 731 | of_platform_device_create(np, "u3-i2c", |
732 | NULL); | ||
731 | break; | 733 | break; |
732 | } | 734 | } |
733 | } | 735 | } |
734 | 736 | ||
735 | np = find_devices("valkyrie"); | 737 | np = find_devices("valkyrie"); |
736 | if (np) | 738 | if (np) |
737 | of_platform_device_create(np, "valkyrie"); | 739 | of_platform_device_create(np, "valkyrie", NULL); |
738 | np = find_devices("platinum"); | 740 | np = find_devices("platinum"); |
739 | if (np) | 741 | if (np) |
740 | of_platform_device_create(np, "platinum"); | 742 | of_platform_device_create(np, "platinum", NULL); |
741 | 743 | ||
742 | return 0; | 744 | return 0; |
743 | } | 745 | } |
diff --git a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c index da8a0f2128dc..93c7231ea709 100644 --- a/arch/ppc/syslib/of_device.c +++ b/arch/ppc/syslib/of_device.c | |||
@@ -234,7 +234,9 @@ void of_device_unregister(struct of_device *ofdev) | |||
234 | device_unregister(&ofdev->dev); | 234 | device_unregister(&ofdev->dev); |
235 | } | 235 | } |
236 | 236 | ||
237 | struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id) | 237 | struct of_device* of_platform_device_create(struct device_node *np, |
238 | const char *bus_id, | ||
239 | struct device *parent) | ||
238 | { | 240 | { |
239 | struct of_device *dev; | 241 | struct of_device *dev; |
240 | u32 *reg; | 242 | u32 *reg; |
@@ -247,7 +249,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char * | |||
247 | dev->node = of_node_get(np); | 249 | dev->node = of_node_get(np); |
248 | dev->dma_mask = 0xffffffffUL; | 250 | dev->dma_mask = 0xffffffffUL; |
249 | dev->dev.dma_mask = &dev->dma_mask; | 251 | dev->dev.dma_mask = &dev->dma_mask; |
250 | dev->dev.parent = NULL; | 252 | dev->dev.parent = parent; |
251 | dev->dev.bus = &of_platform_bus_type; | 253 | dev->dev.bus = &of_platform_bus_type; |
252 | dev->dev.release = of_release_dev; | 254 | dev->dev.release = of_release_dev; |
253 | 255 | ||
diff --git a/arch/ppc64/kernel/of_device.c b/arch/ppc64/kernel/of_device.c index da580812ddfe..9f200f0f2ad5 100644 --- a/arch/ppc64/kernel/of_device.c +++ b/arch/ppc64/kernel/of_device.c | |||
@@ -233,7 +233,9 @@ void of_device_unregister(struct of_device *ofdev) | |||
233 | device_unregister(&ofdev->dev); | 233 | device_unregister(&ofdev->dev); |
234 | } | 234 | } |
235 | 235 | ||
236 | struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id) | 236 | struct of_device* of_platform_device_create(struct device_node *np, |
237 | const char *bus_id, | ||
238 | struct device *parent) | ||
237 | { | 239 | { |
238 | struct of_device *dev; | 240 | struct of_device *dev; |
239 | 241 | ||
@@ -245,7 +247,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char * | |||
245 | dev->node = np; | 247 | dev->node = np; |
246 | dev->dma_mask = 0xffffffffUL; | 248 | dev->dma_mask = 0xffffffffUL; |
247 | dev->dev.dma_mask = &dev->dma_mask; | 249 | dev->dev.dma_mask = &dev->dma_mask; |
248 | dev->dev.parent = NULL; | 250 | dev->dev.parent = parent; |
249 | dev->dev.bus = &of_platform_bus_type; | 251 | dev->dev.bus = &of_platform_bus_type; |
250 | dev->dev.release = of_release_dev; | 252 | dev->dev.release = of_release_dev; |
251 | 253 | ||
@@ -259,6 +261,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char * | |||
259 | return dev; | 261 | return dev; |
260 | } | 262 | } |
261 | 263 | ||
264 | |||
262 | EXPORT_SYMBOL(of_match_device); | 265 | EXPORT_SYMBOL(of_match_device); |
263 | EXPORT_SYMBOL(of_platform_bus_type); | 266 | EXPORT_SYMBOL(of_platform_bus_type); |
264 | EXPORT_SYMBOL(of_register_driver); | 267 | EXPORT_SYMBOL(of_register_driver); |
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c index 325426c7bed0..25755252067a 100644 --- a/arch/ppc64/kernel/pmac_setup.c +++ b/arch/ppc64/kernel/pmac_setup.c | |||
@@ -434,15 +434,23 @@ static int pmac_check_legacy_ioport(unsigned int baseport) | |||
434 | 434 | ||
435 | static int __init pmac_declare_of_platform_devices(void) | 435 | static int __init pmac_declare_of_platform_devices(void) |
436 | { | 436 | { |
437 | struct device_node *np; | 437 | struct device_node *np, *npp; |
438 | 438 | ||
439 | np = find_devices("u3"); | 439 | npp = of_find_node_by_name(NULL, "u3"); |
440 | if (np) { | 440 | if (npp) { |
441 | for (np = np->child; np != NULL; np = np->sibling) | 441 | for (np = NULL; (np = of_get_next_child(npp, np)) != NULL;) { |
442 | if (strncmp(np->name, "i2c", 3) == 0) { | 442 | if (strncmp(np->name, "i2c", 3) == 0) { |
443 | of_platform_device_create(np, "u3-i2c"); | 443 | of_platform_device_create(np, "u3-i2c", NULL); |
444 | of_node_put(np); | ||
444 | break; | 445 | break; |
445 | } | 446 | } |
447 | } | ||
448 | of_node_put(npp); | ||
449 | } | ||
450 | npp = of_find_node_by_type(NULL, "smu"); | ||
451 | if (npp) { | ||
452 | of_platform_device_create(npp, "smu", NULL); | ||
453 | of_node_put(npp); | ||
446 | } | 454 | } |
447 | 455 | ||
448 | return 0; | 456 | return 0; |
diff --git a/arch/ppc64/kernel/pmac_time.c b/arch/ppc64/kernel/pmac_time.c index 3059edb09cc8..41bbb8c59697 100644 --- a/arch/ppc64/kernel/pmac_time.c +++ b/arch/ppc64/kernel/pmac_time.c | |||
@@ -84,7 +84,7 @@ void __pmac pmac_get_rtc_time(struct rtc_time *tm) | |||
84 | 84 | ||
85 | #ifdef CONFIG_PMAC_SMU | 85 | #ifdef CONFIG_PMAC_SMU |
86 | case SYS_CTRLER_SMU: | 86 | case SYS_CTRLER_SMU: |
87 | smu_get_rtc_time(tm); | 87 | smu_get_rtc_time(tm, 1); |
88 | break; | 88 | break; |
89 | #endif /* CONFIG_PMAC_SMU */ | 89 | #endif /* CONFIG_PMAC_SMU */ |
90 | default: | 90 | default: |
@@ -128,7 +128,7 @@ int __pmac pmac_set_rtc_time(struct rtc_time *tm) | |||
128 | 128 | ||
129 | #ifdef CONFIG_PMAC_SMU | 129 | #ifdef CONFIG_PMAC_SMU |
130 | case SYS_CTRLER_SMU: | 130 | case SYS_CTRLER_SMU: |
131 | return smu_set_rtc_time(tm); | 131 | return smu_set_rtc_time(tm, 1); |
132 | #endif /* CONFIG_PMAC_SMU */ | 132 | #endif /* CONFIG_PMAC_SMU */ |
133 | default: | 133 | default: |
134 | return -ENODEV; | 134 | return -ENODEV; |