From patchwork Wed May 8 02:33:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 16765 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ADE2D238FD for ; Wed, 8 May 2013 02:35:32 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id w16sf1627003vbb.9 for ; Tue, 07 May 2013 19:35:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=/hVN1iPTWU8N7eoa6VJWAESJ5bF9LFEqOqMket/ObiY=; b=Ty3ukSiFiwnIYOFkVoZ4JBkz0YYeuyWotIhgETsBIXu8/TTRY0TGCM3B9CsuDdGLhZ QyZqn0VWtYidhN3fn8uP4Z0Of1b/qqW5JSt9yOAWtwwabWcOg9/t56QQ/QCDjxEDkKrv M9DZME6ymZqEDe0GdClSVvBayrelhmgmwQVu3W4A8pfloTVIklQaVUsKMLrfPaBVQKZD TNR8tKtCU64jwvQc+eZvsRjDQOtQgIjZGjqwUhw42GlGjNxhHSFsFlkja/KFwm3LfSYF IxCqzy2rmm5VLpiXTBZIcScSc4Z2AUdRuUe0DRCyuvVHdQmMgR/oNrFuOjlas/6U5Aji uJkA== X-Received: by 10.224.59.205 with SMTP id m13mr6492108qah.7.1367980512514; Tue, 07 May 2013 19:35:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.25.18 with SMTP id y18ls674808qef.5.gmail; Tue, 07 May 2013 19:35:12 -0700 (PDT) X-Received: by 10.58.210.162 with SMTP id mv2mr3207863vec.11.1367980512271; Tue, 07 May 2013 19:35:12 -0700 (PDT) Received: from mail-ve0-x22a.google.com (mail-ve0-x22a.google.com [2607:f8b0:400c:c01::22a]) by mx.google.com with ESMTPS id bb6si241130vcb.84.2013.05.07.19.35.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 May 2013 19:35:12 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22a; Received: by mail-ve0-f170.google.com with SMTP id 15so1333082vea.1 for ; Tue, 07 May 2013 19:35:12 -0700 (PDT) X-Received: by 10.52.175.200 with SMTP id cc8mr2685324vdc.94.1367980512157; Tue, 07 May 2013 19:35:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp131033veb; Tue, 7 May 2013 19:35:11 -0700 (PDT) X-Received: by 10.180.108.3 with SMTP id hg3mr6968814wib.17.1367980510816; Tue, 07 May 2013 19:35:10 -0700 (PDT) Received: from mail-we0-x22a.google.com (mail-we0-x22a.google.com [2a00:1450:400c:c03::22a]) by mx.google.com with ESMTPS id ic8si158606wjb.202.2013.05.07.19.35.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 May 2013 19:35:10 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22a is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=2a00:1450:400c:c03::22a; Received: by mail-we0-f170.google.com with SMTP id u54so1323673wes.1 for ; Tue, 07 May 2013 19:35:10 -0700 (PDT) X-Received: by 10.194.58.78 with SMTP id o14mr7171102wjq.39.1367980510280; Tue, 07 May 2013 19:35:10 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id v6sm6823630wiy.11.2013.05.07.19.35.08 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 May 2013 19:35:09 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: Stefano.Stabellini@eu.citrix.com, patches@linaro.org, ian.campbell@citrix.com, Anthony PERARD , Julien Grall Subject: [PATCH V2 30/33] xen/arm: Add Exynos 4210 UART support for early printk Date: Wed, 8 May 2013 03:33:50 +0100 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-Gm-Message-State: ALoCoQnOKPTRlMXxie9AtZYEsbOTmH9wKlAM/MLY9u0T7UYtSeUkgDiCyPvi9iOS57UAVeYFWg17 X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Anthony PERARD Signed-off-by: Anthony PERARD Signed-off-by: Julien Grall Changes in v2: - Use assembly macro instead of function - Add Anthony as first author --- docs/misc/arm/early-printk.txt | 1 + xen/arch/arm/Rules.mk | 4 ++ xen/arch/arm/arm32/Makefile | 1 - xen/arch/arm/arm32/debug-exynos4210.inc | 77 +++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 xen/arch/arm/arm32/debug-exynos4210.inc diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt index 4065811..d5cae85 100644 --- a/docs/misc/arm/early-printk.txt +++ b/docs/misc/arm/early-printk.txt @@ -10,5 +10,6 @@ option should not be enable for Xens that are intended to be portable. CONFIG_EARLY_PRINTK=mach where mach is the name of the machine: - vexpress: printk with pl011 for versatile express + - exynos5250: printk with the second UART By default early printk is disabled. diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk index 4af052c..cff834e 100644 --- a/xen/arch/arm/Rules.mk +++ b/xen/arch/arm/Rules.mk @@ -47,6 +47,10 @@ ifeq ($(CONFIG_EARLY_PRINTK), vexpress) EARLY_PRINTK := y EARLY_PRINTK_INC := pl011 endif +ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) +EARLY_PRINTK := y +EARLY_PRINTK_INC := exynos4210 +endif CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile index 6af8ca3..aaf277a 100644 --- a/xen/arch/arm/arm32/Makefile +++ b/xen/arch/arm/arm32/Makefile @@ -8,4 +8,3 @@ obj-y += traps.o obj-y += domain.o obj-$(EARLY_PRINTK) += debug.o -obj-$(CONFIG_EARLY_PL011) += debug-pl011.o diff --git a/xen/arch/arm/arm32/debug-exynos4210.inc b/xen/arch/arm/arm32/debug-exynos4210.inc new file mode 100644 index 0000000..17ee5f1 --- /dev/null +++ b/xen/arch/arm/arm32/debug-exynos4210.inc @@ -0,0 +1,77 @@ +/* + * xen/arch/arm/arm32/debug-exynos4210.inc + * + * Exynos 5 specific debug code + * + * Copyright (c) 2013 Citrix Systems. + * + * 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. + */ + +#include + +#define EARLY_UART_BASE_ADDRESS 0x12c20000 + +/* Exynos 5 UART initialization + * rb: register which containts the UART base address + * rc: scratch register 1 + * rd: scratch register 2 */ +.macro early_uart_init rb rc rd + /* init clock */ + ldr \rc, =0x10020000 + /* select MPLL (800MHz) source clock */ + ldr \rd, [\rc, #0x250] + and \rd, \rd, #(~(0xf<<8)) + orr \rd, \rd, #(0x6<<8) + str \rd, [\rc, #0x250] + /* ratio 800/(7+1) */ + ldr \rd, [\rc, #0x558] + and \rd, \rd, #(~(0xf<<8)) + orr \rd, \rd, #(0x7<<8) + str \rd, [\rc, #0x558] + + mov \rc, #4 + str \rc, [\rb, #UFRACVAL] /* -> UFRACVAL (Baud divisor fraction) */ + mov \rc, #53 + str \rc, [\rb, #UBRDIV] /* -> UBRDIV (Baud divisor integer) */ + mov \rc, #3 /* 8n1 */ + str \rc, [\rb, #ULCON] /* -> (Line control) */ + ldr \rc, =UCON_TX_IRQ /* TX IRQMODE */ + str \rc, [\rb, #UCON] /* -> (Control Register) */ + mov \rc, #0x0 + str \rc, [\rb, #UFCON] /* disable FIFO */ + mov \rc, #0x0 + str \rc, [\rb, #UMCON] /* no auto flow control */ +.endm + +/* Exynos 5 UART wait UART to be ready to transmit + * rb: register which containts the UART base address + * rc: scratch register */ +.macro early_uart_ready rb rc +1: + ldr \rc, [\rb, #UTRSTAT] /* <- UTRSTAT (Flag register) */ + tst \rc, #UTRSTAT_TX_EMPTY /* Check BUSY bit */ + beq 1b /* Wait for the UART to be ready */ +.endm + +/* Exynos 5 UART transmit character + * rb: register which containts the UART base address + * rt: register which containts the character to transmit */ +.macro early_uart_transmit rb rt + str \rt, [\rb, #UTXH] /* -> UTXH (Data Register) */ +.endm + +/* + * Local variables: + * mode: ASM + * indent-tabs-mode: nil + * End: + */