Subject: defining platform_devices in DTS

From: Pieter <[email-masked]>
Date: Wed, 25 Feb 2009 11:20:52 +0200

Hi all

I am busy porting my board to Linux 2.6.27 from 2.6.19. The old Linux
was compiled using the ppc architecture, and had a "platform_device"
struct ure containing the custom devices on my board. (
/arch/ppc/platform/sdh8548.c and /arch/ppc/platform/sdh8548.h )

I assume these devices should now be declared in the device tree source.
Building the new Linux using the powerpc architecture, but I am
strugeling translating teh information defined in the "platform_device"
to a device tree node. In particular what happens to the resource.flags
could anyone help please?

Below is the "platform_device" definition and my interpretation of how
it should look in the device tree. Am I on the right track?
thanks pieter

platform_device definition:
  {
        .name = "bio",
        .id = 0,
        .dev.platform_data = NULL,
        .num_resources = 2,
        .resource = (struct resource[]) {
            {
                .start  = 0xe0100000,
                .end    = 0xe0100000 + 0x10000 -1,
                .flags  = IORESOURCE_MEM,    /* 0x00000200 */
            },
            {
                .name   = "int",
                .start  = MPC85xx_IRQ_EXT0,    /* 48 +
MPC85xx_OPENPIC_IRQ_OFFSET */
                .end    = MPC85xx_IRQ_EXT0,
                .flags  = IORESOURCE_IRQ,    /*0x00000400 */
            },
        },

FDT source:
    localbus@e0000000 {
        #address-cells = <2>;
        #size-cells = <1>;
        compatible = "simple-bus";
        reg = <0xe0000000 0x5000>;
        interrupt-parent = <&mpic>;

        ranges = <
            0x0 0x0 0xf8000000 0x07ffffff        /*128MB Flash*/
            0x1 0x0 0xe0200000 0x00200000        /*2MB FPGA*/
            0x2 0x0 0xe0100000 0x00100000         /*1MB BIO CPLD*/
        >;

        bio@2,0 {
            compatible = "wrs,epld-localbus";
            #address-cells = <2>;
            #size-cells = <1>;
            //interrupt-parent = <&mpic>;
            //interrupts = <48>;
            reg = <0x2 0x0 0x0010000>;
            ranges = <0x0 0x0 0x2 0x0 0x00100000>;
        };