of_serial and device trees

Scott Wood scottwood at freescale.com
Thu Mar 26 03:39:33 EST 2009


Simon Kagstrom wrote:
> There are no other versions yet, but I suppose there will be (it's
> implemented in a FPGA after all!). So what is the general handling of
> versions, should it be something like
> 
>   compatible = "ericsson,isf-pic", "ericsson,isf-pic-v2"
> 
> etc if we'd make new revisions of the device?

Looks good.

>> I'm guessing that your FPGA PIC driver isn't getting its register address
>> from the device tree, given that it works without the ranges property?
> 
> It is, but I didn't check it for correctness yet, so I suppose I might
> have mapped the wrong thing. The code looks like this:
> 
>         struct resource phys_addr;
> 
>         if (of_address_to_resource(np, 0, &phys_addr) != 0) {
>                  printk(KERN_ERR": Could not get ISF PIC memory resource\n");
>                  return NULL;
>          }
> 
> 	spin_lock_init(&isf->lock);
> 	isf->ioaddr = ioremap(phys_addr.start,
> 	                phys_addr.end - phys_addr.start);

That looks good -- I'd have expected of_address_to_resource to fail, 
though, when the ranges property was missing.  The kernel's device tree 
parsing code can sometimes be overly tolerant of broken device trees, 
which is probably what happened.

-Scott



More information about the Linuxppc-dev mailing list