Commit 5c1589a9 authored by Russell King's avatar Russell King

[ARM] Add support for dev->coherent_dma_mask

This adds AMBA and SA11xx support for dev->coherent_dma_mask.
parent 808f7931
...@@ -199,8 +199,12 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) ...@@ -199,8 +199,12 @@ int amba_device_register(struct amba_device *dev, struct resource *parent)
dev->dev.release = amba_device_release; dev->dev.release = amba_device_release;
dev->dev.bus = &amba_bustype; dev->dev.bus = &amba_bustype;
dev->dev.dma_mask = &dev->dma_mask;
dev->res.name = dev->dev.bus_id; dev->res.name = dev->dev.bus_id;
if (!dev->dev.coherent_dma_mask && dev->dma_mask)
dev_warn(&dev->dev, "coherent dma mask is unset\n");
ret = request_resource(parent, &dev->res); ret = request_resource(parent, &dev->res);
if (ret == 0) { if (ret == 0) {
tmp = ioremap(dev->res.start, SZ_4K); tmp = ioremap(dev->res.start, SZ_4K);
......
...@@ -516,6 +516,8 @@ sa1111_configure_smc(struct sa1111 *sachip, int sdram, unsigned int drac, ...@@ -516,6 +516,8 @@ sa1111_configure_smc(struct sa1111 *sachip, int sdram, unsigned int drac,
*/ */
if (sachip->dev->dma_mask) if (sachip->dev->dma_mask)
*sachip->dev->dma_mask &= sa1111_dma_mask[drac >> 2]; *sachip->dev->dma_mask &= sa1111_dma_mask[drac >> 2];
sachip->dev->coherent_dma_mask &= sa1111_dma_mask[drac >> 2];
} }
#endif #endif
...@@ -558,6 +560,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent, ...@@ -558,6 +560,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
dev->dev.parent = sachip->dev; dev->dev.parent = sachip->dev;
dev->dev.bus = &sa1111_bus_type; dev->dev.bus = &sa1111_bus_type;
dev->dev.release = sa1111_dev_release; dev->dev.release = sa1111_dev_release;
dev->dev.coherent_dma_mask = sachip->dev->coherent_dma_mask;
dev->res.start = sachip->phys + info->offset; dev->res.start = sachip->phys + info->offset;
dev->res.end = dev->res.start + 511; dev->res.end = dev->res.start + 511;
dev->res.name = dev->dev.bus_id; dev->res.name = dev->dev.bus_id;
......
...@@ -47,6 +47,7 @@ static struct platform_device sa1111_device = { ...@@ -47,6 +47,7 @@ static struct platform_device sa1111_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa1111_dmamask, .dma_mask = &sa1111_dmamask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa1111_resources), .num_resources = ARRAY_SIZE(sa1111_resources),
.resource = sa1111_resources, .resource = sa1111_resources,
......
...@@ -55,6 +55,7 @@ static struct platform_device sa1111_device = { ...@@ -55,6 +55,7 @@ static struct platform_device sa1111_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa1111_dmamask; .dma_mask = &sa1111_dmamask;
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa1111_resources), .num_resources = ARRAY_SIZE(sa1111_resources),
.resource = sa1111_resources, .resource = sa1111_resources,
......
...@@ -162,6 +162,7 @@ static struct platform_device sa11x0udc_device = { ...@@ -162,6 +162,7 @@ static struct platform_device sa11x0udc_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa11x0udc_dma_mask, .dma_mask = &sa11x0udc_dma_mask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa11x0udc_resources), .num_resources = ARRAY_SIZE(sa11x0udc_resources),
.resource = sa11x0udc_resources, .resource = sa11x0udc_resources,
...@@ -212,6 +213,7 @@ static struct platform_device sa11x0mcp_device = { ...@@ -212,6 +213,7 @@ static struct platform_device sa11x0mcp_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa11x0mcp_dma_mask, .dma_mask = &sa11x0mcp_dma_mask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa11x0mcp_resources), .num_resources = ARRAY_SIZE(sa11x0mcp_resources),
.resource = sa11x0mcp_resources, .resource = sa11x0mcp_resources,
...@@ -232,6 +234,7 @@ static struct platform_device sa11x0ssp_device = { ...@@ -232,6 +234,7 @@ static struct platform_device sa11x0ssp_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa11x0ssp_dma_mask, .dma_mask = &sa11x0ssp_dma_mask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa11x0ssp_resources), .num_resources = ARRAY_SIZE(sa11x0ssp_resources),
.resource = sa11x0ssp_resources, .resource = sa11x0ssp_resources,
...@@ -253,6 +256,9 @@ static struct resource sa11x0fb_resources[] = { ...@@ -253,6 +256,9 @@ static struct resource sa11x0fb_resources[] = {
static struct platform_device sa11x0fb_device = { static struct platform_device sa11x0fb_device = {
.name = "sa11x0-fb", .name = "sa11x0-fb",
.id = 0, .id = 0,
.dev = {
.coherent_dma_mask = 0xffffffff,
},
.num_resources = ARRAY_SIZE(sa11x0fb_resources), .num_resources = ARRAY_SIZE(sa11x0fb_resources),
.resource = sa11x0fb_resources, .resource = sa11x0fb_resources,
}; };
......
...@@ -44,6 +44,7 @@ static struct platform_device sa1111_device = { ...@@ -44,6 +44,7 @@ static struct platform_device sa1111_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa1111_dmamask, .dma_mask = &sa1111_dmamask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa1111_resources), .num_resources = ARRAY_SIZE(sa1111_resources),
.resource = sa1111_resources, .resource = sa1111_resources,
......
...@@ -44,6 +44,7 @@ static struct platform_device sa1111_device = { ...@@ -44,6 +44,7 @@ static struct platform_device sa1111_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa1111_dmamask, .dma_mask = &sa1111_dmamask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa1111_resources), .num_resources = ARRAY_SIZE(sa1111_resources),
.resource = sa1111_resources, .resource = sa1111_resources,
......
...@@ -251,6 +251,7 @@ static struct platform_device sa1111_device = { ...@@ -251,6 +251,7 @@ static struct platform_device sa1111_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa1111_dmamask, .dma_mask = &sa1111_dmamask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa1111_resources), .num_resources = ARRAY_SIZE(sa1111_resources),
.resource = sa1111_resources, .resource = sa1111_resources,
......
...@@ -38,6 +38,7 @@ static struct platform_device sa1111_device = { ...@@ -38,6 +38,7 @@ static struct platform_device sa1111_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa1111_dmamask, .dma_mask = &sa1111_dmamask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa1111_resources), .num_resources = ARRAY_SIZE(sa1111_resources),
.resource = sa1111_resources, .resource = sa1111_resources,
......
...@@ -393,6 +393,7 @@ static struct platform_device sa1111_device = { ...@@ -393,6 +393,7 @@ static struct platform_device sa1111_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa1111_dmamask, .dma_mask = &sa1111_dmamask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa1111_resources), .num_resources = ARRAY_SIZE(sa1111_resources),
.resource = sa1111_resources, .resource = sa1111_resources,
......
...@@ -45,6 +45,7 @@ static struct platform_device sa1111_device = { ...@@ -45,6 +45,7 @@ static struct platform_device sa1111_device = {
.id = 0, .id = 0,
.dev = { .dev = {
.dma_mask = &sa1111_dmamask, .dma_mask = &sa1111_dmamask,
.coherent_dma_mask = 0xffffffff,
}, },
.num_resources = ARRAY_SIZE(sa1111_resources), .num_resources = ARRAY_SIZE(sa1111_resources),
.resource = sa1111_resources, .resource = sa1111_resources,
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
struct amba_device { struct amba_device {
struct device dev; struct device dev;
struct resource res; struct resource res;
u64 dma_mask;
unsigned int periphid; unsigned int periphid;
unsigned int irq[AMBA_NR_IRQS]; unsigned int irq[AMBA_NR_IRQS];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment