Skip to content

Commit

Permalink
[PATCH] ppc64: SMU driver update & i2c support
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: Greg KH <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
ozbenh authored and Linus Torvalds committed Sep 23, 2005
1 parent 0f32907 commit 0365ba7
Show file tree
Hide file tree
Showing 15 changed files with 1,618 additions and 163 deletions.
10 changes: 6 additions & 4 deletions arch/ppc/platforms/pmac_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,25 +719,27 @@ pmac_declare_of_platform_devices(void)
if (np) {
for (np = np->child; np != NULL; np = np->sibling)
if (strncmp(np->name, "i2c", 3) == 0) {
of_platform_device_create(np, "uni-n-i2c");
of_platform_device_create(np, "uni-n-i2c",
NULL);
break;
}
}
np = find_devices("u3");
if (np) {
for (np = np->child; np != NULL; np = np->sibling)
if (strncmp(np->name, "i2c", 3) == 0) {
of_platform_device_create(np, "u3-i2c");
of_platform_device_create(np, "u3-i2c",
NULL);
break;
}
}

np = find_devices("valkyrie");
if (np)
of_platform_device_create(np, "valkyrie");
of_platform_device_create(np, "valkyrie", NULL);
np = find_devices("platinum");
if (np)
of_platform_device_create(np, "platinum");
of_platform_device_create(np, "platinum", NULL);

return 0;
}
Expand Down
6 changes: 4 additions & 2 deletions arch/ppc/syslib/of_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ void of_device_unregister(struct of_device *ofdev)
device_unregister(&ofdev->dev);
}

struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id)
struct of_device* of_platform_device_create(struct device_node *np,
const char *bus_id,
struct device *parent)
{
struct of_device *dev;
u32 *reg;
Expand All @@ -247,7 +249,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char *
dev->node = of_node_get(np);
dev->dma_mask = 0xffffffffUL;
dev->dev.dma_mask = &dev->dma_mask;
dev->dev.parent = NULL;
dev->dev.parent = parent;
dev->dev.bus = &of_platform_bus_type;
dev->dev.release = of_release_dev;

Expand Down
7 changes: 5 additions & 2 deletions arch/ppc64/kernel/of_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ void of_device_unregister(struct of_device *ofdev)
device_unregister(&ofdev->dev);
}

struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id)
struct of_device* of_platform_device_create(struct device_node *np,
const char *bus_id,
struct device *parent)
{
struct of_device *dev;

Expand All @@ -245,7 +247,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char *
dev->node = np;
dev->dma_mask = 0xffffffffUL;
dev->dev.dma_mask = &dev->dma_mask;
dev->dev.parent = NULL;
dev->dev.parent = parent;
dev->dev.bus = &of_platform_bus_type;
dev->dev.release = of_release_dev;

Expand All @@ -259,6 +261,7 @@ struct of_device* of_platform_device_create(struct device_node *np, const char *
return dev;
}


EXPORT_SYMBOL(of_match_device);
EXPORT_SYMBOL(of_platform_bus_type);
EXPORT_SYMBOL(of_register_driver);
Expand Down
18 changes: 13 additions & 5 deletions arch/ppc64/kernel/pmac_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,23 @@ static int pmac_check_legacy_ioport(unsigned int baseport)

static int __init pmac_declare_of_platform_devices(void)
{
struct device_node *np;
struct device_node *np, *npp;

np = find_devices("u3");
if (np) {
for (np = np->child; np != NULL; np = np->sibling)
npp = of_find_node_by_name(NULL, "u3");
if (npp) {
for (np = NULL; (np = of_get_next_child(npp, np)) != NULL;) {
if (strncmp(np->name, "i2c", 3) == 0) {
of_platform_device_create(np, "u3-i2c");
of_platform_device_create(np, "u3-i2c", NULL);
of_node_put(np);
break;
}
}
of_node_put(npp);
}
npp = of_find_node_by_type(NULL, "smu");
if (npp) {
of_platform_device_create(npp, "smu", NULL);
of_node_put(npp);
}

return 0;
Expand Down
4 changes: 2 additions & 2 deletions arch/ppc64/kernel/pmac_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void __pmac pmac_get_rtc_time(struct rtc_time *tm)

#ifdef CONFIG_PMAC_SMU
case SYS_CTRLER_SMU:
smu_get_rtc_time(tm);
smu_get_rtc_time(tm, 1);
break;
#endif /* CONFIG_PMAC_SMU */
default:
Expand Down Expand Up @@ -128,7 +128,7 @@ int __pmac pmac_set_rtc_time(struct rtc_time *tm)

#ifdef CONFIG_PMAC_SMU
case SYS_CTRLER_SMU:
return smu_set_rtc_time(tm);
return smu_set_rtc_time(tm, 1);
#endif /* CONFIG_PMAC_SMU */
default:
return -ENODEV;
Expand Down
12 changes: 12 additions & 0 deletions drivers/i2c/busses/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,18 @@ config I2C_KEYWEST
This support is also available as a module. If so, the module
will be called i2c-keywest.

config I2C_PMAC_SMU
tristate "Powermac SMU I2C interface"
depends on I2C && PMAC_SMU
help
This supports the use of the I2C interface in the SMU
chip on recent Apple machines like the iMac G5. It is used
among others by the thermal control driver for those machines.
Say Y if you have such a machine.

This support is also available as a module. If so, the module
will be called i2c-pmac-smu.

config I2C_MPC
tristate "MPC107/824x/85xx/52xx"
depends on I2C && PPC32
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/busses/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ obj-$(CONFIG_I2C_ITE) += i2c-ite.o
obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o
obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o
obj-$(CONFIG_I2C_KEYWEST) += i2c-keywest.o
obj-$(CONFIG_I2C_PMAC_SMU) += i2c-pmac-smu.o
obj-$(CONFIG_I2C_MPC) += i2c-mpc.o
obj-$(CONFIG_I2C_MV64XXX) += i2c-mv64xxx.o
obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o
Expand Down
Loading

0 comments on commit 0365ba7

Please sign in to comment.