From patchwork Thu May 30 04:40:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 2633691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id A3701DF2A1 for ; Thu, 30 May 2013 04:55:07 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UhutC-0006ir-BC; Thu, 30 May 2013 04:55:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uhut9-00060w-GO; Thu, 30 May 2013 04:54:59 +0000 Received: from mail-pb0-f44.google.com ([209.85.160.44]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uhut6-00060S-OC for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2013 04:54:57 +0000 Received: by mail-pb0-f44.google.com with SMTP id wz12so10347452pbc.31 for ; Wed, 29 May 2013 21:54:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=YcwERqGFHg8QqEKNqgpHZFa0XiRC88nlaCcHJ0l/fw8=; b=Ij3R2683Evp6wfLcS3wstidRKzh86NQlp3rMNr7+IbkEnOZ9axvCGHevvqX4laIiX1 ouYnhtS3bIzxadn2yxnEpaPkrZBKA9iIkQvZKlTAWRr+QPTEgOQbSWuCMQGJGRkGjrgJ 8OL6xEwfiHVvPT7K+FQFbgEVQeqp20EXJGQSbBKcMNfSAXaTjmzn81W6duUJZTNvW8n2 yvFwFAl9auLrbvkbVWA7DCOVGwslw2up2zEUMWCXmM21IbZhMgSkrDmCf7l2X633iVZF di46FoDvbaQg3cl8YLyi6sOwNxvkK4n5K5UNmg1gl2XEVOoWZPCDhhCAH9C6V0AF1b8k lx1g== X-Received: by 10.68.37.100 with SMTP id x4mr6034740pbj.122.1369889670318; Wed, 29 May 2013 21:54:30 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id vz8sm42867993pac.20.2013.05.29.21.54.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 May 2013 21:54:29 -0700 (PDT) From: Tushar Behera To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] ARM: EXYNOS: Consolidate multiple low-level UART port definitions Date: Thu, 30 May 2013 10:10:27 +0530 Message-Id: <1369888827-9427-1-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnN3h9s8T3dYu3zVN4l0YirIVGzFEWy0Ks+2b5r64JFHTP+nrFDAQggA1oolxK6qQOLPQRR X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130530_005456_879329_818FE8E9 X-CRM114-Status: GOOD ( 16.95 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.44 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: olof@lixom.net, kgene.kim@samsung.com, arnd@arndb.de, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There are two definitions for low-level UART ports for Exynos platform. CONFIG_S3C_LOWLEVEL_UART_PORT is used for printing "Uncompressing Linux... done, booting the kernel." and CONFIG_S3C_UART for other low-level messages. The assumption for both the uart ports is that they are pre-configured in the bootloader. Since they are essentially the same always, it would be good to consolidate them to use only one macro, in this case 'DEBUG_S3C_UART' would be a better option. 'DEBUG_S3C_UART' is defined only if DEBUG_LL is enabled. We can safely disable this option when DEBUG_LL is not defined and we can boot various boards with different UART port settings. Only drawback of this approach is that when DEBUG_LL is not defined, we would be missing the print "Uncompressing Linux... done, booting the kernel." Since CONFIG_S3C_LOWLEVEL_UART_PORT is still used by other Samsung boards, the consolidation applies only for ARCH_EXYNOS. Signed-off-by: Tushar Behera Acked-by: Kevin Hilman --- arch/arm/mach-exynos/include/mach/uncompress.h | 11 ++++++++--- arch/arm/plat-samsung/include/plat/uncompress.h | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-exynos/include/mach/uncompress.h b/arch/arm/mach-exynos/include/mach/uncompress.h index 2979995..45b5c2a 100644 --- a/arch/arm/mach-exynos/include/mach/uncompress.h +++ b/arch/arm/mach-exynos/include/mach/uncompress.h @@ -37,11 +37,16 @@ static void arch_detect_cpu(void) chip_id >>= 20; chip_id &= 0xf; +#ifdef CONFIG_DEBUG_LL if (chip_id == 0x5) - uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT); + uart_base = (volatile u8 *)EXYNOS5_PA_UART + + (S3C_UART_OFFSET * CONFIG_DEBUG_S3C_UART); else - uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT); - + uart_base = (volatile u8 *)EXYNOS4_PA_UART + + (S3C_UART_OFFSET * CONFIG_DEBUG_S3C_UART); +#else + uart_base = 0; +#endif /* * For preventing FIFO overrun or infinite loop of UART console, * fifo_max should be the minimum fifo size of all of the UART channels diff --git a/arch/arm/plat-samsung/include/plat/uncompress.h b/arch/arm/plat-samsung/include/plat/uncompress.h index 438b248..028c2a8 100644 --- a/arch/arm/plat-samsung/include/plat/uncompress.h +++ b/arch/arm/plat-samsung/include/plat/uncompress.h @@ -38,7 +38,11 @@ static void arch_detect_cpu(void); #define FIFO_MAX (14) #ifdef S3C_PA_UART -#define uart_base S3C_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT) +#ifdef CONFIG_DEBUG_LL +#define uart_base (S3C_PA_UART + (S3C_UART_OFFSET * CONFIG_DEBUG_S3C_UART)) +#else +#define uart_base 0 +#endif #endif static __inline__ void @@ -66,6 +70,9 @@ uart_rd(unsigned int reg) static void putc(int ch) { + if (!uart_base) + return; + if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) { int level; @@ -118,7 +125,12 @@ static void arch_decomp_error(const char *x) #ifdef CONFIG_S3C_BOOT_UART_FORCE_FIFO static inline void arch_enable_uart_fifo(void) { - u32 fifocon = uart_rd(S3C2410_UFCON); + u32 fifocon; + + if (!uart_base) + return; + + fifocon = uart_rd(S3C2410_UFCON); if (!(fifocon & S3C2410_UFCON_FIFOMODE)) { fifocon |= S3C2410_UFCON_RESETBOTH;