From patchwork Thu Aug 25 08:37:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Majewski?= X-Patchwork-Id: 111519 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 2D22BB6F68 for ; Thu, 25 Aug 2011 18:37:33 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E04D9280A2; Thu, 25 Aug 2011 10:37:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eHK-Wz5O2HBp; Thu, 25 Aug 2011 10:37:31 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E09ED28099; Thu, 25 Aug 2011 10:37:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1D1F428099 for ; Thu, 25 Aug 2011 10:37:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4hPBSVlPUxy7 for ; Thu, 25 Aug 2011 10:37:24 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by theia.denx.de (Postfix) with ESMTP id 7AA892808B for ; Thu, 25 Aug 2011 10:37:22 +0200 (CEST) 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 <0LQH00E436M89Y@mailout1.w1.samsung.com> for u-boot@lists.denx.de; Thu, 25 Aug 2011 09:37:20 +0100 (BST) 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 <0LQH000QE6M7CZ@spt1.w1.samsung.com> for u-boot@lists.denx.de; Thu, 25 Aug 2011 09:37:20 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id AD5EA27004A; Thu, 25 Aug 2011 10:38:00 +0200 (CEST) Date: Thu, 25 Aug 2011 10:37:15 +0200 From: Lukasz Majewski To: u-boot@lists.denx.de Message-id: <1314261435-29789-1-git-send-email-l.majewski@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.5.4 Cc: Anton Staaf , Kyungmin Park , m.szyprowski@samsung.com Subject: [U-Boot] =?utf-8?q?_=5BPATCH=5D_dcache=3A_Dcache_line_size_aligne?= =?utf-8?q?d_stack_buffer_allocation?= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This commit is defining new include/cache.h file, which defines macro needed for cache aligned buffers. ALLOC_CACHE_ALIGN_BUFFER shall be used in functions, which are using stack allocated buffers for DMA transfers. Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park CC: Albert ARIBAUD --- include/cache.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) create mode 100644 include/cache.h diff --git a/include/cache.h b/include/cache.h new file mode 100644 index 0000000..d06a0ac --- /dev/null +++ b/include/cache.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * Ɓukasz Majewski + * + * Configuation settings for the SAMSUNG Universal (s5pc100) board. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __GENERIC_CACHE_H_ +#define __GENERIC_CACHE_H_ + +#if defined(CONFIG_SYS_CACHELINE_SIZE) && !defined(CONFIG_SYS_DCACHE_OFF) +#define ALIGN_ADDR(addr) ((void *)(((unsigned long) addr + \ + CONFIG_SYS_CACHELINE_SIZE - 1) \ + & ~(CONFIG_SYS_CACHELINE_SIZE - 1))) + +#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) \ + char *__##name[size + CONFIG_SYS_CACHELINE_SIZE]; \ + type *name = ALIGN_ADDR(__##name); +#else +#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) \ + type name[size]; +#endif + +#endif /* __GENERIC_CACHE_H_ */