From patchwork Sun Apr 14 17:50:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Tomer X-Patchwork-Id: 10899911 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 6017613B5 for ; Sun, 14 Apr 2019 17:52:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 468A62787C for ; Sun, 14 Apr 2019 17:52:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34D9028789; Sun, 14 Apr 2019 17:52:22 +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 930F52787C for ; Sun, 14 Apr 2019 17:52:21 +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 1hFjGm-0001qH-LD; Sun, 14 Apr 2019 17:50:20 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hFjGl-0001qA-6v for xen-devel@lists.xenproject.org; Sun, 14 Apr 2019 17:50:19 +0000 X-Inumbo-ID: c367d3cf-5edd-11e9-92d7-bc764e045a96 Received: from mail-pf1-x441.google.com (unknown [2607:f8b0:4864:20::441]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c367d3cf-5edd-11e9-92d7-bc764e045a96; Sun, 14 Apr 2019 17:50:17 +0000 (UTC) Received: by mail-pf1-x441.google.com with SMTP id e24so7433006pfi.12 for ; Sun, 14 Apr 2019 10:50:17 -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=Uf3oVtCZ0E7oGCP51/SCIoovwDE6Pde9k5hoxT2L5DE=; b=pMqOOK/zb8/ckQ6vsnrPUAVyaPaYgmlDuM6kZ7q80zqOv3p8qLf6ONbuCJAk72MyLv XnbYZcAGRVhCZhuyK3K6uDZX2nD3+tVqGmQIEvUO2S3LJh9CYIzAWn3PRluKniyeXhwS 7BQPkfPpXB2kKDEegPnXRy02WlDuFGPlzcYNtCvi4bWeXJOmnWpvV1Cjd7yYj9BnMKBZ L6rlF0QrpDDiF1kWbbmmu8ZlpfujuWywM1DJNvLvGo5srnnLAq2v/jwFQQHR8mVCHzAN xkphVhdRxs4Ee5zNibLcxAgKWR/Dsrq8WYXagcDHJQ0zVIcKLgFbCO6x0mzNZNigFgsj TF6A== 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=Uf3oVtCZ0E7oGCP51/SCIoovwDE6Pde9k5hoxT2L5DE=; b=pKOEf190n9uI4cI2e72USnoinem52Lr3zRIOHF+KK6KAJjzT7rIA2JdBdHENaKtPzG MUqEeOOy0sHxkQl/CJ9AkQkZUy7EDPCGsINkIp7zvEvnQ4IekQyPjH8UbE/z9OpK7UiG md2a3XmGmeU+zf7ZH/NSq011bxQjz+avGUh+/KXI1E5oTjjILksYftaCefiJWrkHJ54X ntJkrEVE75Hl2sKmJLx2V6Nx2j5t3QrJlEnK2SCRg9zR00Be3sIcpV+Hjk9kz1wanW3C W2eNvuZoPz+hMYT1wmwxgGSwo+G1tprwgne1am53olNzw02F+BXKjO/MFDouwNFCC3a+ EIkg== X-Gm-Message-State: APjAAAUr6ujz8EndLdojbFPTfw2U2yJiEaEsq8p3mdbVgkTetuU2OePQ 4TKWPmZXYBXPD89mZkzSUq51IMdb X-Google-Smtp-Source: APXvYqwIEbh4zn90abOsuMX3ZMqKXRXjV+aH8nRzW9Iu+viAeoSEiD9yzPAhL3pafjo7dPnpIfy/gw== X-Received: by 2002:a62:a515:: with SMTP id v21mr70368303pfm.41.1555264216195; Sun, 14 Apr 2019 10:50:16 -0700 (PDT) Received: from localhost.localdomain ([106.215.44.17]) by smtp.gmail.com with ESMTPSA id p14sm60675573pfa.26.2019.04.14.10.50.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Apr 2019 10:50:15 -0700 (PDT) From: Amit Singh Tomar To: xen-devel@lists.xenproject.org Date: Sun, 14 Apr 2019 23:20:06 +0530 Message-Id: <1555264206-19673-1-git-send-email-amittomer25@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [Xen-devel] [PATCH v4] 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. ATF[1] and U-boot[2] already initialize the UART for us. So no need to do it again. 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 [2]: https://github.com/u-boot/u-boot/blob/master/drivers/serial/serial_meson.c#L44 Signed-off-by: Amit Singh Tomar Acked-by: Julien Grall --- Changes since v3: * Change the commit message to include firmware names. 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: + */