From patchwork Fri Mar 1 08:41:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 2200641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 6B99F3FCA4 for ; Fri, 1 Mar 2013 08:44:49 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UBLXc-0007K4-Vj; Fri, 01 Mar 2013 08:42:08 +0000 Received: from mail-da0-f50.google.com ([209.85.210.50]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UBLXa-0007Ja-Mw for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2013 08:42:07 +0000 Received: by mail-da0-f50.google.com with SMTP id h15so1299602dan.37 for ; Fri, 01 Mar 2013 00:42:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=hkp5TP+bgD39q+wAjJEGPv0kWVLk9Id1izWU9zwJY/c=; b=FEwAytcXISFatgFdevomwHHxFIjTN+nMOMsDfgu56FXw09S56j+bkn+Eq6ecbqPCej ONT3k7UCAk8CeF2TPrw97DIDgiyLig6GWi+cRNloFuWZ9Nc8TrldzGQ+Nz82e21lACef l/P7zJLFSOs2BlWlHpaNi4l5wGhSIjSXSCi76aVgMKULomsPfkUCet5j7SbZnCDLWiEG 7zLgt7t0fmR3n955zuo3zNbcXB8qAzK3LQ/c7RHBSc4rJYpiEJ7O/KbfaZ5EbqQb9iv9 fotC/dYgbJhqcDhFJ5yB7EAd0H6v85axje+kEL/N/oWwlJIbm3mvFWY/UJ7/0dq4J1pa pE0w== X-Received: by 10.68.219.195 with SMTP id pq3mr13693038pbc.184.1362127322770; Fri, 01 Mar 2013 00:42:02 -0800 (PST) Received: from pnqlab006.amcc.com ([122.170.124.90]) by mx.google.com with ESMTPS id z6sm12378627pav.3.2013.03.01.00.41.59 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Mar 2013 00:42:01 -0800 (PST) From: Anup Patel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH V2] arm64: add support for 8250/16550 earlyprintk Date: Fri, 1 Mar 2013 14:11:47 +0530 Message-Id: <1362127307-7986-1-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnOfosmleKwpwlAxumhB0XNFm5BgZ/qsnqYtWC3u/xFigBsUcoBsNYBh1n1IkSlVLYvYYED X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130301_034206_814921_AD702E84 X-CRM114-Status: GOOD ( 10.84 ) 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.210.50 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linaro-dev@lists.linaro.org, Anup Patel 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 This patch adds support for using earlyprintk with 8250/16550 UART ports. The 8250/16550 UART can either have 8-bit or 32-bit aligned registers which is HW vendor dependent. Kernel args for 8-bit aligned regs: earlyprintk=uart8250-8bit, Kernel args for 32-bit aligned regs: earlyprintk=uart8250-32bit, Signed-off-by: Anup Patel Reviewed-by: Marc Zyngier --- arch/arm64/kernel/early_printk.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c index 7e320a2..c39e90b 100644 --- a/arch/arm64/kernel/early_printk.c +++ b/arch/arm64/kernel/early_printk.c @@ -24,11 +24,32 @@ #include #include +#include static void __iomem *early_base; static void (*printch)(char ch); /* + * 8250/16550 (8-bit aligned registers) single character TX. + */ +static void uart8250_8bit_printch(char ch) +{ + while (!(readb_relaxed(early_base + UART_LSR) & UART_LSR_THRE)) + ; + writeb_relaxed(ch, early_base + UART_TX); +} + +/* + * 8250/16550 (32-bit aligned registers) single character TX. + */ +static void uart8250_32bit_printch(char ch) +{ + while (!(readl_relaxed(early_base + (UART_LSR << 2)) & UART_LSR_THRE)) + ; + writel_relaxed(ch, early_base + (UART_TX << 2)); +} + +/* * PL011 single character TX. */ static void pl011_printch(char ch) @@ -47,6 +68,8 @@ struct earlycon_match { static const struct earlycon_match earlycon_match[] __initconst = { { .name = "pl011", .printch = pl011_printch, }, + { .name = "uart8250-8bit", .printch = uart8250_8bit_printch, }, + { .name = "uart8250-32bit", .printch = uart8250_32bit_printch, }, {} };