Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6984ee797a8798128e94ab2447c8ed91f0156eb5
Commit:     6984ee797a8798128e94ab2447c8ed91f0156eb5
Parent:     4ef6e68117e93111590d9d4ada1a282304241169
Author:     Benjamin Herrenschmidt <[EMAIL PROTECTED]>
AuthorDate: Thu Jan 11 16:08:41 2007 +1100
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Mon Jan 22 21:27:35 2007 +1100

    [POWERPC] Fix cell's mmio nvram to properly parse device tree
    
    The mmio nvram driver (used by cell only atm) isn't properly parsing
    the device-tree, meaning that nvram isn't found correctly on the new
    Cell blades.  It works ok for old blades where the nvram is at the
    root of the device tree but fails on Malta and CAB when it's hanging
    off axon.  This fixes it by using the proper OF parsing functions.
    
    Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/mmio_nvram.c |   40 +++++++++++++++++++++----------------
 1 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/sysdev/mmio_nvram.c b/arch/powerpc/sysdev/mmio_nvram.c
index ff23f5a..e073e24 100644
--- a/arch/powerpc/sysdev/mmio_nvram.c
+++ b/arch/powerpc/sysdev/mmio_nvram.c
@@ -80,33 +80,39 @@ static ssize_t mmio_nvram_get_size(void)
 int __init mmio_nvram_init(void)
 {
        struct device_node *nvram_node;
-       const unsigned long *buffer;
-       int proplen;
        unsigned long nvram_addr;
+       struct resource r;
        int ret;
 
-       ret = -ENODEV;
        nvram_node = of_find_node_by_type(NULL, "nvram");
-       if (!nvram_node)
+       if (!nvram_node) {
+               printk(KERN_WARNING "nvram: no node found in device-tree\n");
+               return -ENODEV;
+       }
+
+       ret = of_address_to_resource(nvram_node, 0, &r);
+       if (ret) {
+               printk(KERN_WARNING "nvram: failed to get address (err %d)\n",
+                      ret);
                goto out;
-
-       ret = -EIO;
-       buffer = get_property(nvram_node, "reg", &proplen);
-       if (proplen != 2*sizeof(unsigned long))
-               goto out;
-
-       ret = -ENODEV;
-       nvram_addr = buffer[0];
-       mmio_nvram_len = buffer[1];
-       if ( (!mmio_nvram_len) || (!nvram_addr) )
+       }
+       nvram_addr = r.start;
+       mmio_nvram_len = r.end - r.start + 1;
+       if ( (!mmio_nvram_len) || (!nvram_addr) ) {
+               printk(KERN_WARNING "nvram: address or lenght is 0\n");
+               ret = -EIO;
                goto out;
+       }
 
        mmio_nvram_start = ioremap(nvram_addr, mmio_nvram_len);
-       if (!mmio_nvram_start)
+       if (!mmio_nvram_start) {
+               printk(KERN_WARNING "nvram: failed to ioremap\n");
+               ret = -ENOMEM;
                goto out;
+       }
 
-       printk(KERN_INFO "mmio NVRAM, %luk mapped to %p\n",
-              mmio_nvram_len >> 10, mmio_nvram_start);
+       printk(KERN_INFO "mmio NVRAM, %luk at 0x%lx mapped to %p\n",
+              mmio_nvram_len >> 10, nvram_addr, mmio_nvram_start);
 
        ppc_md.nvram_read       = mmio_nvram_read;
        ppc_md.nvram_write      = mmio_nvram_write;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to