diff options
| -rw-r--r-- | arch/powerpc/kernel/prom.c | 21 | ||||
| -rw-r--r-- | arch/ppc/syslib/prom.c | 4 | ||||
| -rw-r--r-- | arch/ppc64/kernel/prom.c | 24 | ||||
| -rw-r--r-- | drivers/macintosh/smu.c | 164 | ||||
| -rw-r--r-- | fs/proc/proc_devtree.c | 57 | ||||
| -rw-r--r-- | include/asm-powerpc/prom.h | 2 | ||||
| -rw-r--r-- | include/asm-powerpc/smu.h | 153 | ||||
| -rw-r--r-- | include/asm-ppc/prom.h | 2 | ||||
| -rw-r--r-- | include/asm-ppc64/prom.h | 2 | ||||
| -rw-r--r-- | include/linux/proc_fs.h | 9 |
10 files changed, 381 insertions, 57 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 3675ef4bac90..f645adb57534 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
| @@ -1974,14 +1974,29 @@ EXPORT_SYMBOL(get_property); | |||
| 1974 | /* | 1974 | /* |
| 1975 | * Add a property to a node | 1975 | * Add a property to a node |
| 1976 | */ | 1976 | */ |
| 1977 | void prom_add_property(struct device_node* np, struct property* prop) | 1977 | int prom_add_property(struct device_node* np, struct property* prop) |
| 1978 | { | 1978 | { |
| 1979 | struct property **next = &np->properties; | 1979 | struct property **next; |
| 1980 | 1980 | ||
| 1981 | prop->next = NULL; | 1981 | prop->next = NULL; |
| 1982 | while (*next) | 1982 | write_lock(&devtree_lock); |
| 1983 | next = &np->properties; | ||
| 1984 | while (*next) { | ||
| 1985 | if (strcmp(prop->name, (*next)->name) == 0) { | ||
| 1986 | /* duplicate ! don't insert it */ | ||
| 1987 | write_unlock(&devtree_lock); | ||
| 1988 | return -1; | ||
| 1989 | } | ||
| 1983 | next = &(*next)->next; | 1990 | next = &(*next)->next; |
| 1991 | } | ||
| 1984 | *next = prop; | 1992 | *next = prop; |
| 1993 | write_unlock(&devtree_lock); | ||
| 1994 | |||
| 1995 | /* try to add to proc as well if it was initialized */ | ||
| 1996 | if (np->pde) | ||
| 1997 | proc_device_tree_add_prop(np->pde, prop); | ||
| 1998 | |||
| 1999 | return 0; | ||
| 1985 | } | 2000 | } |
| 1986 | 2001 | ||
| 1987 | /* I quickly hacked that one, check against spec ! */ | 2002 | /* I quickly hacked that one, check against spec ! */ |
diff --git a/arch/ppc/syslib/prom.c b/arch/ppc/syslib/prom.c index 1b9aa0d6a924..03b1fc9b9501 100644 --- a/arch/ppc/syslib/prom.c +++ b/arch/ppc/syslib/prom.c | |||
| @@ -1165,7 +1165,7 @@ get_property(struct device_node *np, const char *name, int *lenp) | |||
| 1165 | /* | 1165 | /* |
| 1166 | * Add a property to a node | 1166 | * Add a property to a node |
| 1167 | */ | 1167 | */ |
| 1168 | void | 1168 | int |
| 1169 | prom_add_property(struct device_node* np, struct property* prop) | 1169 | prom_add_property(struct device_node* np, struct property* prop) |
| 1170 | { | 1170 | { |
| 1171 | struct property **next = &np->properties; | 1171 | struct property **next = &np->properties; |
| @@ -1174,6 +1174,8 @@ prom_add_property(struct device_node* np, struct property* prop) | |||
| 1174 | while (*next) | 1174 | while (*next) |
| 1175 | next = &(*next)->next; | 1175 | next = &(*next)->next; |
| 1176 | *next = prop; | 1176 | *next = prop; |
| 1177 | |||
| 1178 | return 0; | ||
| 1177 | } | 1179 | } |
| 1178 | 1180 | ||
| 1179 | /* I quickly hacked that one, check against spec ! */ | 1181 | /* I quickly hacked that one, check against spec ! */ |
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c index 0e8961dea3bc..3402fbee62c7 100644 --- a/arch/ppc64/kernel/prom.c +++ b/arch/ppc64/kernel/prom.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/initrd.h> | 31 | #include <linux/initrd.h> |
| 32 | #include <linux/bitops.h> | 32 | #include <linux/bitops.h> |
| 33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
| 34 | #include <linux/module.h> | ||
| 34 | 35 | ||
| 35 | #include <asm/prom.h> | 36 | #include <asm/prom.h> |
| 36 | #include <asm/rtas.h> | 37 | #include <asm/rtas.h> |
| @@ -1865,17 +1866,32 @@ get_property(struct device_node *np, const char *name, int *lenp) | |||
| 1865 | EXPORT_SYMBOL(get_property); | 1866 | EXPORT_SYMBOL(get_property); |
| 1866 | 1867 | ||
| 1867 | /* | 1868 | /* |
| 1868 | * Add a property to a node | 1869 | * Add a property to a node. |
| 1869 | */ | 1870 | */ |
| 1870 | void | 1871 | int |
| 1871 | prom_add_property(struct device_node* np, struct property* prop) | 1872 | prom_add_property(struct device_node* np, struct property* prop) |
| 1872 | { | 1873 | { |
| 1873 | struct property **next = &np->properties; | 1874 | struct property **next; |
| 1874 | 1875 | ||
| 1875 | prop->next = NULL; | 1876 | prop->next = NULL; |
| 1876 | while (*next) | 1877 | write_lock(&devtree_lock); |
| 1878 | next = &np->properties; | ||
| 1879 | while (*next) { | ||
| 1880 | if (strcmp(prop->name, (*next)->name) == 0) { | ||
| 1881 | /* duplicate ! don't insert it */ | ||
| 1882 | write_unlock(&devtree_lock); | ||
| 1883 | return -1; | ||
| 1884 | } | ||
| 1877 | next = &(*next)->next; | 1885 | next = &(*next)->next; |
| 1886 | } | ||
| 1878 | *next = prop; | 1887 | *next = prop; |
| 1888 | write_unlock(&devtree_lock); | ||
| 1889 | |||
| 1890 | /* try to add to proc as well if it was initialized */ | ||
| 1891 | if (np->pde) | ||
| 1892 | proc_device_tree_add_prop(np->pde, prop); | ||
| 1893 | |||
| 1894 | return 0; | ||
| 1879 | } | 1895 | } |
| 1880 | 1896 | ||
| 1881 | #if 0 | 1897 | #if 0 |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index a931e508feb6..a83c4acf5710 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
| @@ -47,13 +47,13 @@ | |||
| 47 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
| 48 | #include <asm/of_device.h> | 48 | #include <asm/of_device.h> |
| 49 | 49 | ||
| 50 | #define VERSION "0.6" | 50 | #define VERSION "0.7" |
| 51 | #define AUTHOR "(c) 2005 Benjamin Herrenschmidt, IBM Corp." | 51 | #define AUTHOR "(c) 2005 Benjamin Herrenschmidt, IBM Corp." |
| 52 | 52 | ||
| 53 | #undef DEBUG_SMU | 53 | #undef DEBUG_SMU |
| 54 | 54 | ||
| 55 | #ifdef DEBUG_SMU | 55 | #ifdef DEBUG_SMU |
| 56 | #define DPRINTK(fmt, args...) do { printk(KERN_DEBUG fmt , ##args); } while (0) | 56 | #define DPRINTK(fmt, args...) do { udbg_printf(KERN_DEBUG fmt , ##args); } while (0) |
| 57 | #else | 57 | #else |
| 58 | #define DPRINTK(fmt, args...) do { } while (0) | 58 | #define DPRINTK(fmt, args...) do { } while (0) |
| 59 | #endif | 59 | #endif |
| @@ -92,7 +92,7 @@ struct smu_device { | |||
| 92 | * for now, just hard code that | 92 | * for now, just hard code that |
| 93 | */ | 93 | */ |
| 94 | static struct smu_device *smu; | 94 | static struct smu_device *smu; |
| 95 | 95 | static DECLARE_MUTEX(smu_part_access); | |
| 96 | 96 | ||
| 97 | /* | 97 | /* |
| 98 | * SMU driver low level stuff | 98 | * SMU driver low level stuff |
| @@ -113,9 +113,11 @@ static void smu_start_cmd(void) | |||
| 113 | 113 | ||
| 114 | DPRINTK("SMU: starting cmd %x, %d bytes data\n", cmd->cmd, | 114 | DPRINTK("SMU: starting cmd %x, %d bytes data\n", cmd->cmd, |
| 115 | cmd->data_len); | 115 | cmd->data_len); |
| 116 | DPRINTK("SMU: data buffer: %02x %02x %02x %02x ...\n", | 116 | DPRINTK("SMU: data buffer: %02x %02x %02x %02x %02x %02x %02x %02x\n", |
| 117 | ((u8 *)cmd->data_buf)[0], ((u8 *)cmd->data_buf)[1], | 117 | ((u8 *)cmd->data_buf)[0], ((u8 *)cmd->data_buf)[1], |
| 118 | ((u8 *)cmd->data_buf)[2], ((u8 *)cmd->data_buf)[3]); | 118 | ((u8 *)cmd->data_buf)[2], ((u8 *)cmd->data_buf)[3], |
| 119 | ((u8 *)cmd->data_buf)[4], ((u8 *)cmd->data_buf)[5], | ||
| 120 | ((u8 *)cmd->data_buf)[6], ((u8 *)cmd->data_buf)[7]); | ||
| 119 | 121 | ||
| 120 | /* Fill the SMU command buffer */ | 122 | /* Fill the SMU command buffer */ |
| 121 | smu->cmd_buf->cmd = cmd->cmd; | 123 | smu->cmd_buf->cmd = cmd->cmd; |
| @@ -440,7 +442,7 @@ int smu_present(void) | |||
| 440 | EXPORT_SYMBOL(smu_present); | 442 | EXPORT_SYMBOL(smu_present); |
| 441 | 443 | ||
| 442 | 444 | ||
| 443 | int smu_init (void) | 445 | int __init smu_init (void) |
| 444 | { | 446 | { |
| 445 | struct device_node *np; | 447 | struct device_node *np; |
| 446 | u32 *data; | 448 | u32 *data; |
| @@ -845,16 +847,154 @@ int smu_queue_i2c(struct smu_i2c_cmd *cmd) | |||
| 845 | return 0; | 847 | return 0; |
| 846 | } | 848 | } |
| 847 | 849 | ||
| 848 | struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size) | 850 | /* |
| 851 | * Handling of "partitions" | ||
| 852 | */ | ||
| 853 | |||
| 854 | static int smu_read_datablock(u8 *dest, unsigned int addr, unsigned int len) | ||
| 855 | { | ||
| 856 | DECLARE_COMPLETION(comp); | ||
| < | |||
