* [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support
@ 2019-04-14 6:33 ` Amit Singh Tomar
0 siblings, 0 replies; 8+ messages in thread
From: Amit Singh Tomar @ 2019-04-14 6:33 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, julien.grall, sstabellini, Amit Singh Tomar
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 <amittomer25@gmail.com>
---
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 <amittomer25@gmail.com>.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#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:
+ */
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Xen-devel] [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support
@ 2019-04-14 6:33 ` Amit Singh Tomar
0 siblings, 0 replies; 8+ messages in thread
From: Amit Singh Tomar @ 2019-04-14 6:33 UTC (permalink / raw)
To: xen-devel; +Cc: andre.przywara, julien.grall, sstabellini, Amit Singh Tomar
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 <amittomer25@gmail.com>
---
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 <amittomer25@gmail.com>.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#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:
+ */
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support
@ 2019-04-14 16:10 ` Julien Grall
0 siblings, 0 replies; 8+ messages in thread
From: Julien Grall @ 2019-04-14 16:10 UTC (permalink / raw)
To: Amit Singh Tomar, xen-devel; +Cc: andre.przywara, sstabellini
Hi Amit,
On 4/14/19 7:33 AM, Amit Singh Tomar wrote:
> This patch adds earlyprintk support for Amlogic Meson SoC based
> boards.
>
> It relies on firmware[1] to initialize the UART.
Do all the firmware existing for this platform initialize the UART?
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xen-devel] [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support
@ 2019-04-14 16:10 ` Julien Grall
0 siblings, 0 replies; 8+ messages in thread
From: Julien Grall @ 2019-04-14 16:10 UTC (permalink / raw)
To: Amit Singh Tomar, xen-devel; +Cc: andre.przywara, sstabellini
Hi Amit,
On 4/14/19 7:33 AM, Amit Singh Tomar wrote:
> This patch adds earlyprintk support for Amlogic Meson SoC based
> boards.
>
> It relies on firmware[1] to initialize the UART.
Do all the firmware existing for this platform initialize the UART?
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support
@ 2019-04-14 16:35 ` Amit Tomer
0 siblings, 0 replies; 8+ messages in thread
From: Amit Tomer @ 2019-04-14 16:35 UTC (permalink / raw)
To: Julien Grall; +Cc: xen-devel, Stefano Stabellini, Andre Przywara
Hello,
> Do all the firmware existing for this platform initialize the UART?
U-boot does also initialize the uart for this platform.
https://github.com/u-boot/u-boot/blob/master/drivers/serial/serial_meson.c#L44
Thanks,
-Amit
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xen-devel] [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support
@ 2019-04-14 16:35 ` Amit Tomer
0 siblings, 0 replies; 8+ messages in thread
From: Amit Tomer @ 2019-04-14 16:35 UTC (permalink / raw)
To: Julien Grall; +Cc: xen-devel, Stefano Stabellini, Andre Przywara
Hello,
> Do all the firmware existing for this platform initialize the UART?
U-boot does also initialize the uart for this platform.
https://github.com/u-boot/u-boot/blob/master/drivers/serial/serial_meson.c#L44
Thanks,
-Amit
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support
@ 2019-04-14 16:39 ` Julien Grall
0 siblings, 0 replies; 8+ messages in thread
From: Julien Grall @ 2019-04-14 16:39 UTC (permalink / raw)
To: Amit Tomer; +Cc: xen-devel, Stefano Stabellini, Andre Przywara
On 4/14/19 5:35 PM, Amit Tomer wrote:
> Hello,
Hi,
>> Do all the firmware existing for this platform initialize the UART?
>
> U-boot does also initialize the uart for this platform.
> https://github.com/u-boot/u-boot/blob/master/drivers/serial/serial_meson.c#L44
How about replacing "It relies on firmware..." by "ATF and U-boot
already initialize the UART for us. So no need to do it again."
So the user at least know what has been verified.
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Xen-devel] [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support
@ 2019-04-14 16:39 ` Julien Grall
0 siblings, 0 replies; 8+ messages in thread
From: Julien Grall @ 2019-04-14 16:39 UTC (permalink / raw)
To: Amit Tomer; +Cc: xen-devel, Stefano Stabellini, Andre Przywara
On 4/14/19 5:35 PM, Amit Tomer wrote:
> Hello,
Hi,
>> Do all the firmware existing for this platform initialize the UART?
>
> U-boot does also initialize the uart for this platform.
> https://github.com/u-boot/u-boot/blob/master/drivers/serial/serial_meson.c#L44
How about replacing "It relies on firmware..." by "ATF and U-boot
already initialize the UART for us. So no need to do it again."
So the user at least know what has been verified.
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-04-14 16:39 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-14 6:33 [PATCH v3] xen/arm: Add Amlogic Meson SoCs earlyprintk support Amit Singh Tomar
2019-04-14 6:33 ` [Xen-devel] " Amit Singh Tomar
2019-04-14 16:10 ` Julien Grall
2019-04-14 16:10 ` [Xen-devel] " Julien Grall
2019-04-14 16:35 ` Amit Tomer
2019-04-14 16:35 ` [Xen-devel] " Amit Tomer
2019-04-14 16:39 ` Julien Grall
2019-04-14 16:39 ` [Xen-devel] " Julien Grall
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.