of_serial and device trees

Simon Kagstrom simon.kagstrom at ericsson.com
Tue Mar 24 19:49:59 EST 2009


Hi!

I'm working on a custom Freescale 8544-based board and having some
trouble with getting the device tree right. In particular, we have a
setup which looks like this:

* We have an FPGA which contains a few serial ports, an interrupt
  controller and some other devices

* The serial ports are "normal" 16550s and interrupt the FPGA interrupt
  controller

* The interrupt controller is in turn cascaded to the 8544 OpenPIC
  (mpic).

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>;

                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>;
                };

                serial2: isf-serial at 4200 {
                        device_type = "serial";
                        compatible = "ns16550";
                        reg = <4200 100>;
                        clock-frequency = <13ab6680>; /* 330Mhz */
                        interrupts = <0 1>;
                        interrupt-parent = <&isf_pic>;
                };
                <... and a few more serial ports which look the same >

Following the example set in mpc85xx_ds.c, I lookup the interrupt
controller manually in the platform setup code (init_IRQ). Basically

        np = of_find_compatible_node(NULL, "isf-pic", "isf-pic");
        if (np == NULL) {
                printk(KERN_ERR "Could not find ISF PIC\n");
                return;
        }

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.

I suppose I can do something similar in code to what is done in
arch/powerpc/kernel/legacy_serial.c:find_legacy_serial_ports, but I
thought I could do without that with the device trees. Is it so, or do
I have to add code to walk through and setup the rest of the serial
ports?

Thanks in advance,
// Simon



More information about the Linuxppc-dev mailing list