From patchwork Wed Dec 15 20:34:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHDheKAmiBOYXphcmV3aWN6?= X-Patchwork-Id: 414361 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBFKdT2l028292 for ; Wed, 15 Dec 2010 20:39:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753858Ab0LOUiq (ORCPT ); Wed, 15 Dec 2010 15:38:46 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:10405 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753355Ab0LOUio (ORCPT ); Wed, 15 Dec 2010 15:38:44 -0500 Received: from eu_spt1 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0LDH007W1LCCRN@mailout1.w1.samsung.com>; Wed, 15 Dec 2010 20:38:39 +0000 (GMT) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LDH0096CLCDDD@spt1.w1.samsung.com>; Wed, 15 Dec 2010 20:38:37 +0000 (GMT) Received: from pikus.digital.local (unknown [106.116.48.169]) by linux.samsung.com (Postfix) with ESMTP id 655F627005B; Wed, 15 Dec 2010 21:38:13 +0100 (CET) Date: Wed, 15 Dec 2010 21:34:32 +0100 From: Michal Nazarewicz Subject: [PATCHv8 12/12] ARM: cma: Added CMA to Aquila, Goni and c210 universal boards In-reply-to: To: Michal Nazarewicz Cc: Andrew Morton , Ankita Garg , Daniel Walker , Johan MOSSBERG , KAMEZAWA Hiroyuki , Marek Szyprowski , Mel Gorman , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mm@kvack.org Message-id: MIME-version: 1.0 X-Mailer: git-send-email 1.7.2.3 Content-type: TEXT/PLAIN Content-transfer-encoding: 7BIT References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 15 Dec 2010 20:39:29 +0000 (UTC) diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index 53aabef..b395a16 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig @@ -68,6 +68,7 @@ config MACH_AQUILA select S5P_DEV_ONENAND select S5PV210_SETUP_FB_24BPP select S5PV210_SETUP_SDHCI + select CMA_DEVICE_POSSIBLE help Machine support for the Samsung Aquila target based on S5PC110 SoC @@ -92,6 +93,7 @@ config MACH_GONI select S5PV210_SETUP_I2C2 select S5PV210_SETUP_KEYPAD select S5PV210_SETUP_SDHCI + select CMA_DEVICE_POSSIBLE help Machine support for Samsung GONI board S5PC110(MCP) is one of package option of S5PV210 diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c index 28677ca..8608a16 100644 --- a/arch/arm/mach-s5pv210/mach-aquila.c +++ b/arch/arm/mach-s5pv210/mach-aquila.c @@ -39,6 +39,7 @@ #include #include #include +#include /* Following are default values for UCON, ULCON and UFCON UART registers */ #define AQUILA_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ @@ -690,4 +691,5 @@ MACHINE_START(AQUILA, "Aquila") .map_io = aquila_map_io, .init_machine = aquila_machine_init, .timer = &s3c24xx_timer, + .reserve = cma_mach_reserve, MACHINE_END diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index b1dcf96..b1bf079 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c @@ -45,6 +45,7 @@ #include #include #include +#include /* Following are default values for UCON, ULCON and UFCON UART registers */ #define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ @@ -865,4 +866,5 @@ MACHINE_START(GONI, "GONI") .map_io = goni_map_io, .init_machine = goni_machine_init, .timer = &s3c24xx_timer, + .reserve = cma_mach_reserve, MACHINE_END diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig index d64efe0..ae4e0da 100644 --- a/arch/arm/mach-s5pv310/Kconfig +++ b/arch/arm/mach-s5pv310/Kconfig @@ -85,6 +85,7 @@ config MACH_UNIVERSAL_C210 select S5P_DEV_ONENAND select S3C_DEV_I2C1 select S5PV310_SETUP_I2C1 + select CMA_DEVICE_POSSIBLE help Machine support for Samsung Mobile Universal S5PC210 Reference Board. S5PC210(MCP) is one of package option of S5PV310 diff --git a/arch/arm/mach-s5pv310/mach-universal_c210.c b/arch/arm/mach-s5pv310/mach-universal_c210.c index 16d8fc0..d65703a 100644 --- a/arch/arm/mach-s5pv310/mach-universal_c210.c +++ b/arch/arm/mach-s5pv310/mach-universal_c210.c @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -152,6 +153,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") .boot_params = S5P_PA_SDRAM + 0x100, .init_irq = s5pv310_init_irq, .map_io = universal_map_io, + .reserve = cma_mach_reserve, .init_machine = universal_machine_init, .timer = &s5pv310_timer, MACHINE_END diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile index de65238..6fdb6ce 100644 --- a/arch/arm/plat-s5p/Makefile +++ b/arch/arm/plat-s5p/Makefile @@ -28,3 +28,5 @@ obj-$(CONFIG_S5P_DEV_FIMC0) += dev-fimc0.o obj-$(CONFIG_S5P_DEV_FIMC1) += dev-fimc1.o obj-$(CONFIG_S5P_DEV_FIMC2) += dev-fimc2.o obj-$(CONFIG_S5P_DEV_ONENAND) += dev-onenand.o + +obj-$(CONFIG_CMA) += cma-stub.o diff --git a/arch/arm/plat-s5p/cma-stub.c b/arch/arm/plat-s5p/cma-stub.c new file mode 100644 index 0000000..c175ba8 --- /dev/null +++ b/arch/arm/plat-s5p/cma-stub.c @@ -0,0 +1,49 @@ +/* + * This file is just a quick and dirty hack to get CMA testing device + * working. The cma_mach_reserve() should be called as mach's reserve + * callback. CMA testing device will use cma_ctx for allocations. + */ + +#include + +#include +#include +#include +#include + +struct cma *cma_ctx; + +#define cma_size (32UL << 20) /* 32 MiB */ + +static unsigned long cma_start __initdata; + +void __init cma_mach_reserve(void) +{ + unsigned long start = cma_reserve(0, cma_size, 0, true); + if (IS_ERR_VALUE(start)) + printk(KERN_WARNING "cma: unable to reserve %lu for CMA: %d\n", + cma_size >> 20, (int)start); + else + cma_start = start; +} + +static int __init cma_mach_init(void) +{ + int ret = -ENOMEM; + + if (cma_start) { + struct cma *ctx = cma_create(cma_start, cma_size); + if (IS_ERR(ctx)) { + ret = PTR_ERR(ctx); + printk(KERN_WARNING + "cma: cma_create(%p, %p) failed: %d\n", + (void *)cma_start, (void *)cma_size, ret); + } else { + cma_ctx = ctx; + ret = 0; + } + } + + return ret; +} +device_initcall(cma_mach_init); diff --git a/arch/arm/plat-s5p/include/plat/cma-stub.h b/arch/arm/plat-s5p/include/plat/cma-stub.h new file mode 100644 index 0000000..a24a03b --- /dev/null +++ b/arch/arm/plat-s5p/include/plat/cma-stub.h @@ -0,0 +1,21 @@ +/* + * This file is just a quick and dirty hack to get CMA testing device + * working. The cma_mach_reserve() should be called as mach's reserve + * callback. CMA testing device will use cma_ctx for allocations. + */ + +struct cma; + +#ifdef CONFIG_CMA + +extern struct cma *cma_ctx; + +void cma_mach_reserve(void); + +#else + +#define cma_ctx ((struct cma *)NULL) + +#define cma_mach_reserve NULL + +#endif