From patchwork Thu May 2 17:00:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Tyshchenko X-Patchwork-Id: 10927361 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 1866992A for ; Thu, 2 May 2019 17:02:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0572A204FA for ; Thu, 2 May 2019 17:02:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDF06205FD; Thu, 2 May 2019 17:02:07 +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 7A48E205E9 for ; Thu, 2 May 2019 17:02:07 +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 1hMF4Y-000204-2b; Thu, 02 May 2019 17:00:38 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hMF4W-0001zC-RX for xen-devel@lists.xenproject.org; Thu, 02 May 2019 17:00:36 +0000 X-Inumbo-ID: cd1dd1c2-6cfb-11e9-843c-bc764e045a96 Received: from mail-lj1-x242.google.com (unknown [2a00:1450:4864:20::242]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id cd1dd1c2-6cfb-11e9-843c-bc764e045a96; Thu, 02 May 2019 17:00:35 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id d15so2845145ljc.7 for ; Thu, 02 May 2019 10:00:35 -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:in-reply-to:references; bh=BUeJ4Nqs+OAGSA0yR8DXF/JEAPhi1bA5d5M1uVIU/18=; b=Yy17sJEbmxpCh6ZNPi0wMu1CFiTwyPjTVLdh2qGx0Kn0L3WWN/phTI+VRlfoffgB28 9gmfvMRIL+yHgHM8W07OJNQyMm/wu2cLTOr9ayGRb9tCRW4TEN2KbYLqZL+GjpzGJ/S5 QjlvAZXw2m+pizDWI5NoKXI7pr3nCOsabi0oSO+PZvnXyra6as8nOOmtw0sSSsoaOkn7 ZMtBTgp7ZfWgPvIKc6loY3yspnYwfgMfAYuPRGcL7J/DIqj871V5M4CYFlb19h2LcGb8 ezO8K4aCul/Wv1zq0lxOIFFNFes2rmqS4nkhCAfl2BOGl6JfqtEjNANbXypN3RQCBppt 4ZRA== 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:in-reply-to :references; bh=BUeJ4Nqs+OAGSA0yR8DXF/JEAPhi1bA5d5M1uVIU/18=; b=Rd7Z4VS5FkKrDe7iAvloCxVbiBEjH5jTSun2kh0IIlvvUWQB5i1wiKmT0mj8RJxFkx U9nKt3tWpzthJuHFBs4DIsoz6+nNbna+7YjXw02N6o8Pub7R6c0EbaGTFQVixJXq/sGC 2ZuHEGqqUaRIhz9gC1Fj93fAYd5VfQVxY6RBebDmV9t10p/+XYiPAAvWNb8SP4ltcuHP A5ghVctcIDhNC6DBZfI4OxzBz/eUWTnZk/gSSy8eGLGdUCnS4i/K8IDt7vzuZMEI0Z5V UPiD65GMiP0ObV58Hu87NQmBF2hyprF5ruNPj7wP/bXH062fA+neYme2epYj6uhdt84j Nq8w== X-Gm-Message-State: APjAAAVXac+BsCybe44ehl6VlmdojLSJM2GhGV3GO0h/HORXqCOY28NT /BaECe8FuHDSnTnhxXX/x62CT3SxtcM= X-Google-Smtp-Source: APXvYqxEKeCnfExweq06DNDXPrsdAwjgeIPHshlRd5YxxG1NxqhzEqPKTG1QLYIvVCzEytqzyVJixg== X-Received: by 2002:a2e:988e:: with SMTP id b14mr2495104ljj.126.1556816433836; Thu, 02 May 2019 10:00:33 -0700 (PDT) Received: from otyshchenko.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id k21sm2659652ljb.3.2019.05.02.10.00.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 May 2019 10:00:33 -0700 (PDT) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Date: Thu, 2 May 2019 20:00:21 +0300 Message-Id: <1556816422-25185-4-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556816422-25185-1-git-send-email-olekstysh@gmail.com> References: <1556816422-25185-1-git-send-email-olekstysh@gmail.com> Subject: [Xen-devel] [PATCH V5 3/4] xen/arm: Extend SCIF early prink code to handle other interfaces 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: Oleksandr Tyshchenko , julien.grall@arm.com, sstabellini@kernel.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Tyshchenko Extend early prink code to be able to handle other SCIF(X) compatible interfaces as well. These interfaces have lot in common, but mostly differ in offsets and bits for some registers. Introduce "EARLY_PRINTK_VERSION" config option to choose which interface version should be used (to properly apply register offsets). Please note, nothing has been technically changed for Renesas "Lager" and other supported boards (SCIF). The "EARLY_PRINTK_VERSION" option for that board should be empty: CONFIG_EARLY_PRINTK=scif,0xe6e60000 Signed-off-by: Oleksandr Tyshchenko CC: Julien Grall --- Changes in v3: - It was decided not to introduce new debug-scifa.inc for handling SCIFA interface, but to extend existing debug-scif.inc for handling both interfaces. This patch is a result of splitting an initial patch "xen/arm: Add SCIFA UART support for early printk" and only reworks a code Changes in v4: - Update docs/misc/arm/early-printk.txt with the new option Changes in v5: - Cosmetic fixes (text and comments in code) --- docs/misc/arm/early-printk.txt | 5 +++++ xen/arch/arm/Rules.mk | 7 +++++++ xen/arch/arm/arm32/debug-scif.inc | 17 +++++++++++------ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt index b23c54f..89e081e 100644 --- a/docs/misc/arm/early-printk.txt +++ b/docs/misc/arm/early-printk.txt @@ -27,6 +27,11 @@ CONFIG_EARLY_PRINTK=,, If is not given then the code will not try to initialize the UART, so that bootloader or firmware settings can be used for maximum compatibility. + - scif,, + - SCIF is, optionally, the interface version of the UART. + + If is not given then the default interface version (SCIF) + will be used. - For all other uarts there are no additional options. As a convenience it is also possible to select from a list of diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk index f264592..3d9a0ed 100644 --- a/xen/arch/arm/Rules.mk +++ b/xen/arch/arm/Rules.mk @@ -68,6 +68,13 @@ EARLY_PRINTK_INIT_UART := y EARLY_PRINTK_BAUD := $(word 3,$(EARLY_PRINTK_CFG)) endif endif +ifeq ($(EARLY_PRINTK_INC),scif) +ifneq ($(word 3,$(EARLY_PRINTK_CFG)),) +CFLAGS-y += -DEARLY_PRINTK_VERSION_$(word 3,$(EARLY_PRINTK_CFG)) +else +CFLAGS-y += -DEARLY_PRINTK_VERSION_NONE +endif +endif ifneq ($(EARLY_PRINTK_INC),) EARLY_PRINTK := y diff --git a/xen/arch/arm/arm32/debug-scif.inc b/xen/arch/arm/arm32/debug-scif.inc index 143f05d..6f60e01 100644 --- a/xen/arch/arm/arm32/debug-scif.inc +++ b/xen/arch/arm/arm32/debug-scif.inc @@ -19,28 +19,33 @@ #include +#ifdef EARLY_PRINTK_VERSION_NONE +#define STATUS_REG SCIF_SCFSR +#define TX_FIFO_REG SCIF_SCFTDR +#endif + /* - * SCIF UART wait UART to be ready to transmit + * Wait UART to be ready to transmit * rb: register which contains the UART base address * rc: scratch register */ .macro early_uart_ready rb rc 1: - ldrh \rc, [\rb, #SCIF_SCFSR] /* <- SCFSR (status register) */ + ldrh \rc, [\rb, #STATUS_REG] /* Read status register */ tst \rc, #SCFSR_TDFE /* Check TDFE bit */ beq 1b /* Wait for the UART to be ready */ .endm /* - * SCIF UART transmit character + * UART transmit character * rb: register which contains the UART base address * rt: register which contains the character to transmit */ .macro early_uart_transmit rb rt - strb \rt, [\rb, #SCIF_SCFTDR] /* -> SCFTDR (data register) */ - ldrh \rt, [\rb, #SCIF_SCFSR] /* <- SCFSR (status register) */ + strb \rt, [\rb, #TX_FIFO_REG] /* Write data register */ + ldrh \rt, [\rb, #STATUS_REG] /* Read status register */ and \rt, \rt, #(~(SCFSR_TEND | SCFSR_TDFE)) /* Clear TEND and TDFE bits */ - strh \rt, [\rb, #SCIF_SCFSR] /* -> SCFSR (status register) */ + strh \rt, [\rb, #STATUS_REG] /* Write status register */ .endm /*