* [PATCH] ARM: nitrogen6: add lowlevel UART initialization
@ 2020-01-02 10:23 Rouven Czerwinski
2020-01-02 10:41 ` Ahmad Fatoum
2020-01-06 9:46 ` Lucas Stach
0 siblings, 2 replies; 4+ messages in thread
From: Rouven Czerwinski @ 2020-01-02 10:23 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Mux UART1 and UART2 correctly to allow usage of DEBUG_LL.
This commit has only been tested on nitrogen6q.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
.../boundarydevices-nitrogen6/lowlevel.c | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c b/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
index 74ff71fc24..47c231396d 100644
--- a/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
+++ b/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
@@ -1,16 +1,40 @@
#include <common.h>
+#include <debug_ll.h>
#include <mach/generic.h>
#include <mach/esdctl.h>
#include <asm/barebox-arm.h>
+#include <serial/imx-uart.h>
extern char __dtb_imx6q_nitrogen6x_start[];
+static inline void setup_uart(void)
+{
+ void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR;
+
+ //UART 1
+ writel(0x1, iomuxbase + 0x02a8);
+ writel(0x1, iomuxbase + 0x02ac);
+
+ //UART 2
+ writel(0x4, iomuxbase + 0x00bc);
+ writel(0x4, iomuxbase + 0x00c0);
+ writel(0x0, iomuxbase + 0x0928);
+
+ imx6_ungate_all_peripherals();
+ imx6_uart_setup((void *)MX6_UART2_BASE_ADDR);
+ pbl_set_putc(imx_uart_putc, (void *)MX6_UART2_BASE_ADDR);
+}
+
+
ENTRY_FUNCTION(start_imx6q_nitrogen6x_1g, r0, r1, r2)
{
void *fdt;
imx6_cpu_lowlevel_init();
+ if (IS_ENABLED(CONFIG_DEBUG_LL))
+ setup_uart();
+
fdt = __dtb_imx6q_nitrogen6x_start + get_runtime_offset();
imx6q_barebox_entry(fdt);
--
2.24.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: nitrogen6: add lowlevel UART initialization
2020-01-02 10:23 [PATCH] ARM: nitrogen6: add lowlevel UART initialization Rouven Czerwinski
@ 2020-01-02 10:41 ` Ahmad Fatoum
2020-01-06 9:46 ` Lucas Stach
1 sibling, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2020-01-02 10:41 UTC (permalink / raw)
To: rcz, barebox
Hello Rouven,
On 1/2/20 11:23 AM, Rouven Czerwinski wrote:
> +static inline void setup_uart(void)
> +{
> + void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR;
> +
> + //UART 1
> + writel(0x1, iomuxbase + 0x02a8);
> + writel(0x1, iomuxbase + 0x02ac);
> +
> + //UART 2
> + writel(0x4, iomuxbase + 0x00bc);
> + writel(0x4, iomuxbase + 0x00c0);
> + writel(0x0, iomuxbase + 0x0928);
There's imx_setup_pad that you can use along with symbolic names for
better readability.
> + imx6_ungate_all_peripherals();
> + imx6_uart_setup((void *)MX6_UART2_BASE_ADDR);
There's imx6_uart_setup_ll that passes in the address of CONFIG_DEBUG_IMX_UART_PORT.
Use that one instead.
> + pbl_set_putc(imx_uart_putc, (void *)MX6_UART2_BASE_ADDR);
DEBUG_LL is a global setting. pbl_set_putc can be used to have PBL console
output for a board, even if DEBUG_LL is off or configured for another board.
Thus having pbl_set_putc guarded by a IS_ENABLED(CONFIG_DEBUG_LL) doesn't make
sense. pbl_set_putc can also only be called after relocation, which hasn't
happened yet.
Cheers
Ahmad
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: nitrogen6: add lowlevel UART initialization
2020-01-02 10:23 [PATCH] ARM: nitrogen6: add lowlevel UART initialization Rouven Czerwinski
2020-01-02 10:41 ` Ahmad Fatoum
@ 2020-01-06 9:46 ` Lucas Stach
2020-01-06 10:09 ` Rouven Czerwinski
1 sibling, 1 reply; 4+ messages in thread
From: Lucas Stach @ 2020-01-06 9:46 UTC (permalink / raw)
To: Rouven Czerwinski, barebox
On Do, 2020-01-02 at 11:23 +0100, Rouven Czerwinski wrote:
> Mux UART1 and UART2 correctly to allow usage of DEBUG_LL.
There is only one UART intended as console on this board. Why are you
setting up 2 UARTs here?
Regards,
Lucas
> This commit has only been tested on nitrogen6q.
>
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
> .../boundarydevices-nitrogen6/lowlevel.c | 24
> +++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
> b/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
> index 74ff71fc24..47c231396d 100644
> --- a/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
> +++ b/arch/arm/boards/boundarydevices-nitrogen6/lowlevel.c
> @@ -1,16 +1,40 @@
> #include <common.h>
> +#include <debug_ll.h>
> #include <mach/generic.h>
> #include <mach/esdctl.h>
> #include <asm/barebox-arm.h>
> +#include <serial/imx-uart.h>
>
> extern char __dtb_imx6q_nitrogen6x_start[];
>
> +static inline void setup_uart(void)
> +{
> + void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR;
> +
> + //UART 1
> + writel(0x1, iomuxbase + 0x02a8);
> + writel(0x1, iomuxbase + 0x02ac);
> +
> + //UART 2
> + writel(0x4, iomuxbase + 0x00bc);
> + writel(0x4, iomuxbase + 0x00c0);
> + writel(0x0, iomuxbase + 0x0928);
> +
> + imx6_ungate_all_peripherals();
> + imx6_uart_setup((void *)MX6_UART2_BASE_ADDR);
> + pbl_set_putc(imx_uart_putc, (void *)MX6_UART2_BASE_ADDR);
> +}
> +
> +
> ENTRY_FUNCTION(start_imx6q_nitrogen6x_1g, r0, r1, r2)
> {
> void *fdt;
>
> imx6_cpu_lowlevel_init();
>
> + if (IS_ENABLED(CONFIG_DEBUG_LL))
> + setup_uart();
> +
> fdt = __dtb_imx6q_nitrogen6x_start + get_runtime_offset();
>
> imx6q_barebox_entry(fdt);
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: nitrogen6: add lowlevel UART initialization
2020-01-06 9:46 ` Lucas Stach
@ 2020-01-06 10:09 ` Rouven Czerwinski
0 siblings, 0 replies; 4+ messages in thread
From: Rouven Czerwinski @ 2020-01-06 10:09 UTC (permalink / raw)
To: Lucas Stach, barebox
On Mon, 2020-01-06 at 10:46 +0100, Lucas Stach wrote:
> On Do, 2020-01-02 at 11:23 +0100, Rouven Czerwinski wrote:
> > Mux UART1 and UART2 correctly to allow usage of DEBUG_LL.
>
> There is only one UART intended as console on this board. Why are you
> setting up 2 UARTs here?
I am using this to work on OP-TEE, which does not implement the UART
initialization and instead relies on the bootloader. This way barebox
and OP-TEE don't need to share the same UART.
Regards,
Rouven
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-06 10:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-02 10:23 [PATCH] ARM: nitrogen6: add lowlevel UART initialization Rouven Czerwinski
2020-01-02 10:41 ` Ahmad Fatoum
2020-01-06 9:46 ` Lucas Stach
2020-01-06 10:09 ` Rouven Czerwinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox