From: Oleksandr Tyshchenko <olekstysh@gmail.com> To: xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>, julien.grall@arm.com, sstabellini@kernel.org Subject: [PATCH V5 3/4] xen/arm: Extend SCIF early prink code to handle other interfaces Date: Thu, 2 May 2019 20:00:21 +0300 [thread overview] Message-ID: <1556816422-25185-4-git-send-email-olekstysh@gmail.com> (raw) In-Reply-To: <1556816422-25185-1-git-send-email-olekstysh@gmail.com> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> 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 <oleksandr_tyshchenko@epam.com> CC: Julien Grall <julien.grall@arm.com> --- 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=<INC>,<BASE_ADDRESS>,<OTHER_OPTIONS> If <BAUD_RATE> 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,<BASE_ADDRESS>,<VERSION> + - SCIF<VERSION> is, optionally, the interface version of the UART. + + If <VERSION> 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 <asm/scif-uart.h> +#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 /* -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
WARNING: multiple messages have this Message-ID (diff)
From: Oleksandr Tyshchenko <olekstysh@gmail.com> To: xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>, julien.grall@arm.com, sstabellini@kernel.org Subject: [Xen-devel] [PATCH V5 3/4] xen/arm: Extend SCIF early prink code to handle other interfaces Date: Thu, 2 May 2019 20:00:21 +0300 [thread overview] Message-ID: <1556816422-25185-4-git-send-email-olekstysh@gmail.com> (raw) Message-ID: <20190502170021.Xmtfdo5KFMgrW1kmIPcXW6PK1mFDkeCE9h_6fMiaJBQ@z> (raw) In-Reply-To: <1556816422-25185-1-git-send-email-olekstysh@gmail.com> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> 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 <oleksandr_tyshchenko@epam.com> CC: Julien Grall <julien.grall@arm.com> --- 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=<INC>,<BASE_ADDRESS>,<OTHER_OPTIONS> If <BAUD_RATE> 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,<BASE_ADDRESS>,<VERSION> + - SCIF<VERSION> is, optionally, the interface version of the UART. + + If <VERSION> 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 <asm/scif-uart.h> +#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 /* -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-05-02 17:00 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-02 17:00 [PATCH V5 0/4] Renesas Stout board support (R-Car Gen2) Oleksandr Tyshchenko 2019-05-02 17:00 ` [Xen-devel] " Oleksandr Tyshchenko 2019-05-02 17:00 ` [PATCH V5 1/4] xen/arm: drivers: scif: Extend driver to handle other interfaces Oleksandr Tyshchenko 2019-05-02 17:00 ` [Xen-devel] " Oleksandr Tyshchenko 2019-05-02 17:00 ` [PATCH V5 2/4] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs Oleksandr Tyshchenko 2019-05-02 17:00 ` [Xen-devel] " Oleksandr Tyshchenko 2019-05-02 17:00 ` Oleksandr Tyshchenko [this message] 2019-05-02 17:00 ` [Xen-devel] [PATCH V5 3/4] xen/arm: Extend SCIF early prink code to handle other interfaces Oleksandr Tyshchenko 2019-05-07 16:02 ` Julien Grall 2019-05-07 16:02 ` [Xen-devel] " Julien Grall 2019-05-08 9:20 ` Oleksandr 2019-05-08 9:20 ` [Xen-devel] " Oleksandr 2019-05-02 17:00 ` [PATCH V5 4/4] xen/arm: Add early printk support for SCIFA compatible UARTs Oleksandr Tyshchenko 2019-05-02 17:00 ` [Xen-devel] " Oleksandr Tyshchenko 2019-05-07 16:01 ` Julien Grall 2019-05-07 16:01 ` [Xen-devel] " Julien Grall 2019-05-08 16:19 ` [PATCH V5 0/4] Renesas Stout board support (R-Car Gen2) Julien Grall 2019-05-08 16:19 ` [Xen-devel] " Julien Grall 2019-05-08 16:30 ` Oleksandr 2019-05-08 16:30 ` [Xen-devel] " Oleksandr 2019-05-08 16:34 ` Julien Grall 2019-05-08 16:34 ` [Xen-devel] " Julien Grall 2019-05-16 15:44 ` Julien Grall 2019-05-16 15:44 ` [Xen-devel] " Julien Grall 2019-05-16 17:07 ` Oleksandr 2019-05-16 17:07 ` [Xen-devel] " Oleksandr
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1556816422-25185-4-git-send-email-olekstysh@gmail.com \ --to=olekstysh@gmail.com \ --cc=julien.grall@arm.com \ --cc=oleksandr_tyshchenko@epam.com \ --cc=sstabellini@kernel.org \ --cc=xen-devel@lists.xenproject.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.