of_serial and device trees

Michael Ellerman michael at ellerman.id.au
Thu Mar 26 11:53:39 EST 2009


On Wed, 2009-03-25 at 11:39 -0500, Scott Wood wrote:
> 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.

It assumes a missing ranges == empty ranges, which means 1:1. See the
comment in of_translate_one(). And thank Apple ;)

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090326/7eb30b6a/attachment.pgp>


More information about the Linuxppc-dev mailing list