of_serial and device trees

Scott Wood scottwood at freescale.com
Wed Mar 25 02:55:45 EST 2009


On Tue, Mar 24, 2009 at 09:49:59AM +0100, Simon Kagstrom wrote:
> My problem is that I can't figure out how to express this correctly in
> the device tree for the board. My device tree looks like this ("isf" is
> the name of the FPGA):
> 
> 	isf at c0020000 {
> 		#address-cells = <1>;
> 		#size-cells = <1>;
> 		reg = <c0020000 00020000>;
> 

Change this line to: ranges = <0 c0020000 00020000>;
This causes reg resources in child nodes to be properly translated.  What
you have above indicates that all 0x20000 bytes are for the driver of *this*
node.

Add compatible = "simple-bus".  This lets children of this node be probed
by of_platform drivers (make sure you list simple-bus when calling
of_platform_bus_probe), and in a few other places (like legacy_serial.c).

>                 isf_pic: isf_pic at 4000 {
>                         device_type = "isf-pic";
>                         compatible = "isf-pic";
>                         interrupt-controller;
>                         clock-frequency = <0>;
>                         #address-cells = <0>;
>                         #interrupt-cells = <2>;
>                         reg = <4000 100>;
>                         built-in;
>                         interrupts = <4 1>;
>                         interrupt-parent = <&mpic>;

Ged rid of built-in, clock-frequency, and device_type.

Compatible should be of the form "vendor,device" -- and does "isf"
uniquely identify the specific FPGA logic, or are there other versions
out there (or likely to exist in the future)?  Note that there are some
bad examples in existing device trees that have yet to be fixed.

Node name should be interrupt-controller, not isf_pic.

>                         clock-frequency = <13ab6680>; /* 330Mhz */

Note that dts-v1 syntax has C-like constants, with decimal by default. 
I'm guessing you're working with a relatively old kernel?

> and thereafter calling a custom setup function for the FPGA interrupt
> controller. That appears to work fine, but I'm wondering how to get the
> serial ports detected properly by of_serial.

The simple-bus compatible, and ranges property, should do it.  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?

-Scott



More information about the Linuxppc-dev mailing list