powerpc: DMA coherent allocations broken for CONFIG_NOT_COHERENT_CACHE

Grant Likely grant.likely at secretlab.ca
Thu May 28 15:09:05 EST 2009


On Wed, May 27, 2009 at 11:00 PM, Sean MacLennan
<smaclennan at pikatech.com> wrote:
> On Wed, 27 May 2009 21:42:18 -0600
> Grant Likely <grant.likely at secretlab.ca> wrote:
>
>> Make your driver use a platform device or an of_platform device.  It's
>> not at all hard.
>
> Here is my first shot.... any other fields that I need to fill in so I
> don't have any gotchas?
>
> /* This must exist */
> static void warp_device_release(struct device *dev) {}

It will be easier if you do it as an of_device.  Then you just need to
add a node to the device tree and it will get registered correctly
without any platform specific registration code.  That gives your
driver something to bind against.

However, if you do want to do it this way...

> static struct platform_device warp_device = {
>        .name = "warp-device",
>        .id = 0,
>        .num_resources = 0,
>        .dev = {
>                .coherent_dma_mask = ~0ULL,
>                .release = warp_device_release,
>        },
> };

No need for all this.  use platform_device_register_simple() instead.
Again, that gives your driver something to bind again, this time on
the platform bus (instead of of_platform bus).

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.



More information about the Linuxppc-dev mailing list