[PATCH] powerpc/85xx: don't call of_platform_bus_probe() twice

Timur Tabi timur at freescale.com
Tue Mar 20 05:43:29 EST 2012


Grant Likely wrote:
> The problem is that you want to create devices for grandchildren
> nodes when the bus ids passed in don't match any of the child nodes so
> the of_platform_bus_probe() doesn't iterate down to that level.  This
> is correct and expected behaviour.

Well, I'm not still not 100% sure on what I'm supposed to do, so I tried this:

static struct of_device_id __initdata p1022_ds_ids[] = {
	/* The audio driver probes the SSI DMA channels individually */
	{ .compatible = "fsl,ssi-dma-channel", },
	{},
};

static int __init p1022_ds_publish_devices(void)
{
	struct device_node *np;
	int ret;

	mpc85xx_common_publish_devices();

	for_each_compatible_node(np, NULL, "fsl,eloplus-dma") {
		ret = of_platform_bus_probe(np, p1022_ds_ids, NULL);
		if (ret)
			return ret;
	}

	return 0;
}

It works, but it looks clunky.

For the record, this is what the DMA controller node looks like.  It's a
child of the SOC node.  The SSI driver probes on the "fsl,ssi-dma-channel"
nodes directly.

dma at c300 {
        cell-index = <0x1>;
        ranges = <0x0 0xc100 0x200>;
        reg = <0xc300 0x4>;
        compatible = "fsl,eloplus-dma";
        #size-cells = <0x1>;
        #address-cells = <0x1>;

        dma-channel at 180 {
                interrupts = <0x4f 0x2 0x0 0x0>;
                cell-index = <0x3>;
                reg = <0x180 0x80>;
                compatible = "fsl,eloplus-dma-channel";
        };

        dma-channel at 100 {
                interrupts = <0x4e 0x2 0x0 0x0>;
                cell-index = <0x2>;
                reg = <0x100 0x80>;
                compatible = "fsl,eloplus-dma-channel";
        };

        dma-channel at 80 {
                phandle = <0x4>;
                linux,phandle = <0x4>;
                interrupts = <0x4d 0x2 0x0 0x0>;
                cell-index = <0x1>;
                reg = <0x80 0x80>;
                compatible = "fsl,ssi-dma-channel";
        };

        dma-channel at 0 {
                phandle = <0x3>;
                linux,phandle = <0x3>;
                interrupts = <0x4c 0x2 0x0 0x0>;
                cell-index = <0x0>;
                reg = <0x0 0x80>;
                compatible = "fsl,ssi-dma-channel";
        };
};

-- 
Timur Tabi
Linux kernel developer at Freescale



More information about the Linuxppc-dev mailing list