From 5c1589a90a03f28871b8f49f8dde531a9123d85c Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 25 Mar 2004 17:44:51 +0000 Subject: [PATCH] [ARM] Add support for dev->coherent_dma_mask This adds AMBA and SA11xx support for dev->coherent_dma_mask. --- arch/arm/common/amba.c | 4 ++++ arch/arm/common/sa1111.c | 3 +++ arch/arm/mach-sa1100/adsbitsy.c | 1 + arch/arm/mach-sa1100/badge4.c | 1 + arch/arm/mach-sa1100/generic.c | 6 ++++++ arch/arm/mach-sa1100/graphicsmaster.c | 1 + arch/arm/mach-sa1100/jornada720.c | 1 + arch/arm/mach-sa1100/neponset.c | 1 + arch/arm/mach-sa1100/pfs168.c | 1 + arch/arm/mach-sa1100/system3.c | 1 + arch/arm/mach-sa1100/xp860.c | 1 + include/asm-arm/hardware/amba.h | 1 + 12 files changed, 22 insertions(+) diff --git a/arch/arm/common/amba.c b/arch/arm/common/amba.c index 44269538c3c03..f7ddb16e9d665 100644 --- a/arch/arm/common/amba.c +++ b/arch/arm/common/amba.c @@ -199,8 +199,12 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) dev->dev.release = amba_device_release; dev->dev.bus = &amba_bustype; + dev->dev.dma_mask = &dev->dma_mask; 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); if (ret == 0) { tmp = ioremap(dev->res.start, SZ_4K); diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index 32e1a684683a6..18b6c61cd81ed 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c @@ -516,6 +516,8 @@ sa1111_configure_smc(struct sa1111 *sachip, int sdram, unsigned int drac, */ if (sachip->dev->dma_mask) *sachip->dev->dma_mask &= sa1111_dma_mask[drac >> 2]; + + sachip->dev->coherent_dma_mask &= sa1111_dma_mask[drac >> 2]; } #endif @@ -558,6 +560,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent, dev->dev.parent = sachip->dev; dev->dev.bus = &sa1111_bus_type; 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.end = dev->res.start + 511; dev->res.name = dev->dev.bus_id; diff --git a/arch/arm/mach-sa1100/adsbitsy.c b/arch/arm/mach-sa1100/adsbitsy.c index 43f23ae748b43..d028a87ce2ebb 100644 --- a/arch/arm/mach-sa1100/adsbitsy.c +++ b/arch/arm/mach-sa1100/adsbitsy.c @@ -47,6 +47,7 @@ static struct platform_device sa1111_device = { .id = 0, .dev = { .dma_mask = &sa1111_dmamask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa1111_resources), .resource = sa1111_resources, diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c index 9dd52fa0ee00f..71d9e165a3b67 100644 --- a/arch/arm/mach-sa1100/badge4.c +++ b/arch/arm/mach-sa1100/badge4.c @@ -55,6 +55,7 @@ static struct platform_device sa1111_device = { .id = 0, .dev = { .dma_mask = &sa1111_dmamask; + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa1111_resources), .resource = sa1111_resources, diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index bc7d2b064e34c..bc14c39bb796d 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c @@ -162,6 +162,7 @@ static struct platform_device sa11x0udc_device = { .id = 0, .dev = { .dma_mask = &sa11x0udc_dma_mask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa11x0udc_resources), .resource = sa11x0udc_resources, @@ -212,6 +213,7 @@ static struct platform_device sa11x0mcp_device = { .id = 0, .dev = { .dma_mask = &sa11x0mcp_dma_mask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa11x0mcp_resources), .resource = sa11x0mcp_resources, @@ -232,6 +234,7 @@ static struct platform_device sa11x0ssp_device = { .id = 0, .dev = { .dma_mask = &sa11x0ssp_dma_mask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa11x0ssp_resources), .resource = sa11x0ssp_resources, @@ -253,6 +256,9 @@ static struct resource sa11x0fb_resources[] = { static struct platform_device sa11x0fb_device = { .name = "sa11x0-fb", .id = 0, + .dev = { + .coherent_dma_mask = 0xffffffff, + }, .num_resources = ARRAY_SIZE(sa11x0fb_resources), .resource = sa11x0fb_resources, }; diff --git a/arch/arm/mach-sa1100/graphicsmaster.c b/arch/arm/mach-sa1100/graphicsmaster.c index 717c206e5c6d4..77d84368d7acc 100644 --- a/arch/arm/mach-sa1100/graphicsmaster.c +++ b/arch/arm/mach-sa1100/graphicsmaster.c @@ -44,6 +44,7 @@ static struct platform_device sa1111_device = { .id = 0, .dev = { .dma_mask = &sa1111_dmamask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa1111_resources), .resource = sa1111_resources, diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c index 7f586c435868b..c71e512830bd6 100644 --- a/arch/arm/mach-sa1100/jornada720.c +++ b/arch/arm/mach-sa1100/jornada720.c @@ -44,6 +44,7 @@ static struct platform_device sa1111_device = { .id = 0, .dev = { .dma_mask = &sa1111_dmamask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa1111_resources), .resource = sa1111_resources, diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c index 4b6ad81955c80..a747fd0bd89a7 100644 --- a/arch/arm/mach-sa1100/neponset.c +++ b/arch/arm/mach-sa1100/neponset.c @@ -251,6 +251,7 @@ static struct platform_device sa1111_device = { .id = 0, .dev = { .dma_mask = &sa1111_dmamask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa1111_resources), .resource = sa1111_resources, diff --git a/arch/arm/mach-sa1100/pfs168.c b/arch/arm/mach-sa1100/pfs168.c index 65a29e7e2ddcb..43b89fcc89199 100644 --- a/arch/arm/mach-sa1100/pfs168.c +++ b/arch/arm/mach-sa1100/pfs168.c @@ -38,6 +38,7 @@ static struct platform_device sa1111_device = { .id = 0, .dev = { .dma_mask = &sa1111_dmamask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa1111_resources), .resource = sa1111_resources, diff --git a/arch/arm/mach-sa1100/system3.c b/arch/arm/mach-sa1100/system3.c index fce4448eae063..09f679e4e67b1 100644 --- a/arch/arm/mach-sa1100/system3.c +++ b/arch/arm/mach-sa1100/system3.c @@ -393,6 +393,7 @@ static struct platform_device sa1111_device = { .id = 0, .dev = { .dma_mask = &sa1111_dmamask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa1111_resources), .resource = sa1111_resources, diff --git a/arch/arm/mach-sa1100/xp860.c b/arch/arm/mach-sa1100/xp860.c index e67156629765d..501b1bfe8b2b0 100644 --- a/arch/arm/mach-sa1100/xp860.c +++ b/arch/arm/mach-sa1100/xp860.c @@ -45,6 +45,7 @@ static struct platform_device sa1111_device = { .id = 0, .dev = { .dma_mask = &sa1111_dmamask, + .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa1111_resources), .resource = sa1111_resources, diff --git a/include/asm-arm/hardware/amba.h b/include/asm-arm/hardware/amba.h index 17bb14bf43767..0cc74f7f7e0e0 100644 --- a/include/asm-arm/hardware/amba.h +++ b/include/asm-arm/hardware/amba.h @@ -15,6 +15,7 @@ struct amba_device { struct device dev; struct resource res; + u64 dma_mask; unsigned int periphid; unsigned int irq[AMBA_NR_IRQS]; }; -- 2.53.0