From patchwork Sun Apr 14 06:33:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Tomer X-Patchwork-Id: 10899705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0110D139A for ; Sun, 14 Apr 2019 06:36:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D377528B4F for ; Sun, 14 Apr 2019 06:36:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C755328B54; Sun, 14 Apr 2019 06:36:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D598E28B4F for ; Sun, 14 Apr 2019 06:36:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hFYiB-0000dU-2o; Sun, 14 Apr 2019 06:33:55 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hFYi9-0000dP-8Z for xen-devel@lists.xenproject.org; Sun, 14 Apr 2019 06:33:53 +0000 X-Inumbo-ID: 44836bb0-5e7f-11e9-92d7-bc764e045a96 Received: from mail-pf1-x442.google.com (unknown [2607:f8b0:4864:20::442]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 44836bb0-5e7f-11e9-92d7-bc764e045a96; Sun, 14 Apr 2019 06:33:51 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id w25so7046442pfi.9 for ; Sat, 13 Apr 2019 23:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=owxNVnAJ4MtRR0omIw5jro2IGQnbvI8ArzcKNr9mPso=; b=Dz0JB7NW/lCU/VkDuQPIK4bvZATA0BRM7CjhfZQXwg80Kp0UzI6HsmE1Bl7ehEEz7Y iWDqEkRFTP1+OWxmFR1lUzwhTuPwKs1+slOu/f0Awvzx+SCjmBPl1xjHkYNL8g3WZJ2g qyZF0mn2TCwamtufSJhbGAs36doMaPi38+9PpI7Ah6ZGxeL3TiSPK/eC6lUh8Eh6u6Na R4NMslMI221hWvaQclYdYdDucDKz7ITCR0gocufQsKKlA7sCrDv/QIrkzRRf+LDK/mKm x+dThqojo2C0ZqFsOTwMPjVuSqPVJ6GAuAGNVAI4pcNjubls35+yJ7pQSLvBSv/pHZiQ yjXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=owxNVnAJ4MtRR0omIw5jro2IGQnbvI8ArzcKNr9mPso=; b=O5uCcwjWhesr9XCyuly2nN0T2KNJUwyrMnSbvigTFbAl9s5/UphGu+2tcX7DY5Ewvv J+1z2SkA2b0ENB9c8g3byU6HFNIx26lpWHW3qOmoZis/XldGzAjDdhfrRntz3lOVw5fh ilP+HjiSEhzNEtEabqYqBpVn2pl6bQfC46y3LbrFxmuJWbEVOgJMb06vx0bhYjTSZW2o f3S8LwwNnadGMGkXf26UQMYoYQsyf4niXY11mXYS7uvNer5R5iKLAaMnLe1oeS6vT7ra omb6kjOTqz8wv5RyxT5t8j0z7ONZKgHjyCruwj6GdlZyADwq5E8LOuAGMWa3fDastv6d X9Kw== X-Gm-Message-State: APjAAAUwtTr9KFS1Vow9P+Dgy2DP7Rwbi+9sr0unlk+RV4tDRaULCb8a xfqaRXxm6BU+t3cUT1mDtpMrtVDD X-Google-Smtp-Source: APXvYqxhGpYt3+XaAt6Jj+rug7G73OyOphTm+0iRLf/ZlIC9bcCjidP+7zxj9dozNXkki5mFdt0NIA== X-Received: by 2002:aa7:9193:: with SMTP id x19mr68781326pfa.108.1555223630537; Sat, 13 Apr 2019 23:33:50 -0700 (PDT) Received: from localhost.localdomain ([223.190.30.100]) by smtp.gmail.com with ESMTPSA id i15sm64574212pfd.162.2019.04.13.23.33.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Apr 2019 23:33:49 -0700 (PDT) From: Amit Singh Tomar To: xen-devel@lists.xenproject.org Date: Sun, 14 Apr 2019 12:03:31 +0530 Message-Id: <1555223611-10263-1-git-send-email-amittomer25@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [Xen-devel] [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, julien.grall@arm.com, sstabellini@kernel.org, Amit Singh Tomar MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds earlyprintk support for Amlogic Meson SoC based boards. It relies on firmware[1] to initialize the UART. Tested With: http://wiki.friendlyarm.com/wiki/index.php/NanoPi_K2 [1]: https://github.com/ARM-software/arm-trusted-firmware/blob/master/drivers/meson/console/aarch64/meson_console.S#L92 Signed-off-by: Amit Singh Tomar --- Changes since v2: * Added the commit message that talks about uart initialization. * Added dummy early_uart_init function. Changes since v1: * Fixed coding style issue. * Undone changes in early-printk.txt. Changes since RFC: * Replaced LDRH with LDR, with this there is no scattered output on console now. * Used tbnz instead of tst and b.ne. * Used AML_ prefix against register names. --- xen/arch/arm/arm64/debug-meson.inc | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 xen/arch/arm/arm64/debug-meson.inc diff --git a/xen/arch/arm/arm64/debug-meson.inc b/xen/arch/arm/arm64/debug-meson.inc new file mode 100644 index 0000000..e1a8fa8 --- /dev/null +++ b/xen/arch/arm/arm64/debug-meson.inc @@ -0,0 +1,55 @@ +/* + * xen/arch/arm/arm64/debug-meson.inc + * + * MESON specific debug code. + * + * Copyright (c) 2019, Amit Singh Tomar . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms and conditions of the GNU General Public + * License, version 2, as published by the Free Software Foundation. + * + * 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, see . + */ + +#define AML_UART_WFIFO_REG 0x00 +#define AML_UART_STATUS_REG 0x0c + +#define AML_UART_TX_FIFO_FULL 21 + +.macro early_uart_init xb, c +/* Uart has already been initialized by Firmware, for instance by TF-A */ +.endm + +/* + * MESON UART wait UART to be ready to transmit + * xb: register which contains the UART base address + * c: scratch register + */ +.macro early_uart_ready xb c +1: + ldr w\c, [\xb, #AML_UART_STATUS_REG] /* status register */ + tbnz w\c, #AML_UART_TX_FIFO_FULL, 1b /* Check TXFIFO FULL bit */ +.endm + +/* + * MESON UART transmit character + * xb: register which contains the UART base address + * wt: register which contains the character to transmit + */ +.macro early_uart_transmit xb wt + str \wt, [\xb, #AML_UART_WFIFO_REG] +.endm + +/* + * Local variables: + * mode: ASM + * indent-tabs-mode: nil + * End: + */