* [RFC PATCH] ARM: layerscape: zero-index DEBUG_LAYERSCAPE_UART_PORT
@ 2019-09-23 16:15 Ahmad Fatoum
2019-09-27 6:50 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2019-09-23 16:15 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The layerscape features four UART ports termed UART{1-4} in the
reference manual.
In the upstream device tree they have the phandles &duart{0-3}.
Currently, barebox follows the numbering used in the reference manual
for the DEBUG_LL port, because that's what the <soc/fsl/immap_lsch2.h>
header does as well.
It's arguable however that the DEBUG_LL port should be 0-indexed,
because users are most likely to look in the board device tree for the
chosen stdout-path and that one's phandle is zero-indexed.
One notable example of a target with one-indexed DEBUG_LL port is the
i.MX, but there the uart port phandles are one-indexed, so there's no
discrepancy between DEBUG_LL and /chosen/stdout-path like it's the
case with the Layerscape.
Fix the discrepancy by zero-indexing the layerscape UART.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
I guess it can be argued that either way is the correct one.
But I'd say from the viewpoint of a barebox developer, changing it to
zero indexed makes the most sense.
If we go this route, should the config option be renamed to account
for existing configs that set it?
---
arch/arm/mach-layerscape/include/mach/debug_ll.h | 7 ++++++-
common/Kconfig | 3 +--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-layerscape/include/mach/debug_ll.h b/arch/arm/mach-layerscape/include/mach/debug_ll.h
index 2658a4a7c916..df044728c0ba 100644
--- a/arch/arm/mach-layerscape/include/mach/debug_ll.h
+++ b/arch/arm/mach-layerscape/include/mach/debug_ll.h
@@ -4,7 +4,12 @@
#include <io.h>
#include <soc/fsl/immap_lsch2.h>
-#define __LS_UART_BASE(num) LSCH2_NS16550_COM##num
+#define LS_UART0 LSCH2_NS16550_COM1
+#define LS_UART1 LSCH2_NS16550_COM2
+#define LS_UART2 LSCH2_NS16550_COM3
+#define LS_UART3 LSCH2_NS16550_COM4
+
+#define __LS_UART_BASE(num) LS_UART##num
#define LS_UART_BASE(num) __LS_UART_BASE(num)
static inline uint8_t debug_ll_read_reg(int reg)
diff --git a/common/Kconfig b/common/Kconfig
index 8aad5baecdda..f79bef01f8cf 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1264,10 +1264,9 @@ config DEBUG_SOCFPGA_UART_CLOCK
config DEBUG_LAYERSCAPE_UART_PORT
int "Layerscape UART port selection"
depends on ARCH_LAYERSCAPE
- default 1
help
Select the UART port number used for early debugging here. Port
- numbers start counting from 1.
+ numbers start counting from 0.
config DEBUG_AT91_UART_BASE
hex "AT91 Debug UART Port Selection" if DEBUG_AT91_UART
--
2.23.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC PATCH] ARM: layerscape: zero-index DEBUG_LAYERSCAPE_UART_PORT
2019-09-23 16:15 [RFC PATCH] ARM: layerscape: zero-index DEBUG_LAYERSCAPE_UART_PORT Ahmad Fatoum
@ 2019-09-27 6:50 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-09-27 6:50 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Sep 23, 2019 at 06:15:08PM +0200, Ahmad Fatoum wrote:
> The layerscape features four UART ports termed UART{1-4} in the
> reference manual.
> In the upstream device tree they have the phandles &duart{0-3}.
>
> Currently, barebox follows the numbering used in the reference manual
> for the DEBUG_LL port, because that's what the <soc/fsl/immap_lsch2.h>
> header does as well.
>
> It's arguable however that the DEBUG_LL port should be 0-indexed,
> because users are most likely to look in the board device tree for the
> chosen stdout-path and that one's phandle is zero-indexed.
>
> One notable example of a target with one-indexed DEBUG_LL port is the
> i.MX, but there the uart port phandles are one-indexed, so there's no
> discrepancy between DEBUG_LL and /chosen/stdout-path like it's the
> case with the Layerscape.
>
> Fix the discrepancy by zero-indexing the layerscape UART.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> I guess it can be argued that either way is the correct one.
Indeed ;)
> But I'd say from the viewpoint of a barebox developer, changing it to
> zero indexed makes the most sense.
If you could argue that it was inconsistent before and you make it
consistent now, then I would say go for it. Unfortunately it's
inconsistent now and still inconsistent with your patch, so changing
it IMO doesn't improve anything.
> help
> Select the UART port number used for early debugging here. Port
> - numbers start counting from 1.
> + numbers start counting from 0.
Actually I don't care much, so I may be convinced. What I do care about
though is that it's documented, and fortunately in this case it is ;)
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 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] 2+ messages in thread
end of thread, other threads:[~2019-09-27 6:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 16:15 [RFC PATCH] ARM: layerscape: zero-index DEBUG_LAYERSCAPE_UART_PORT Ahmad Fatoum
2019-09-27 6:50 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox