[PATCH 1/3] serial: allow selecting MSM debug UART with ARCH_IPQ40XX

Currently, DEBUG_UART_MSM depends on ARCH_SNAPDRAGON only, but IPQ40XX devices also use the same UART HW so they can also use the debug UART.
So, allow selecting DEBUG_UART_MSM when using ARCH_IPQ40XX as well.
Signed-off-by: Robert Marko robert.marko@sartura.hr --- drivers/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 8b19e2684e..1fe4607598 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -321,7 +321,7 @@ config DEBUG_UART_S5P
config DEBUG_UART_MSM bool "Qualcomm QUP UART debug" - depends on ARCH_SNAPDRAGON + depends on ARCH_SNAPDRAGON || ARCH_IPQ40XX help Select this to enable a debug UART using the serial_msm driver. You will need to provide parameters to make this work. The driver will

MSM serial in DEBUG UART mode is trying to set .clk_rate, but the msm_serial_data structure does not have such property at all, so lets remove it as otherwise it will fail compiling.
Fixes: 90023bdfe979 ("serial: msm: add debug UART") Signed-off-by: Robert Marko robert.marko@sartura.hr --- drivers/serial/serial_msm.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index ac4280c6c4..8044d38518 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -242,7 +242,6 @@ U_BOOT_DRIVER(serial_msm) = {
static struct msm_serial_data init_serial_data = { .base = CONFIG_VAL(DEBUG_UART_BASE), - .clk_rate = 7372800, };
#include <debug_uart.h>

On 15/04/2024 11:49, Robert Marko wrote:
MSM serial in DEBUG UART mode is trying to set .clk_rate, but the msm_serial_data structure does not have such property at all, so lets remove it as otherwise it will fail compiling.
Well that's embarrasing... Thanks :D
Fixes: 90023bdfe979 ("serial: msm: add debug UART") Signed-off-by: Robert Marko robert.marko@sartura.hr
Reviewed-by: Caleb Connolly caleb.connolly@linaro.org
drivers/serial/serial_msm.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index ac4280c6c4..8044d38518 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -242,7 +242,6 @@ U_BOOT_DRIVER(serial_msm) = {
static struct msm_serial_data init_serial_data = { .base = CONFIG_VAL(DEBUG_UART_BASE),
- .clk_rate = 7372800,
};
#include <debug_uart.h>

Currently, .clk_bit_rate is not being set in init_serial_data for debug UART, but its then used uart_dm_init() and this breaks debug UART on IPQ40xx.
So, lets populate .clk_bit_rate for debug UART as well. IPQ40xx requires special value of 0xff, so set it if ARCH_IPQ40XX is selected, otherwise default to the same value that regular DM UART will use.
Signed-off-by: Robert Marko robert.marko@sartura.hr --- drivers/serial/serial_msm.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index 8044d38518..80069f5cfb 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -242,6 +242,11 @@ U_BOOT_DRIVER(serial_msm) = {
static struct msm_serial_data init_serial_data = { .base = CONFIG_VAL(DEBUG_UART_BASE), +#ifdef CONFIG_ARCH_IPQ40XX + .clk_bit_rate = 0xff, +#else + .clk_bit_rate = UART_DM_CLK_RX_TX_BIT_RATE, +#endif };
#include <debug_uart.h>

On 15/04/2024 11:49, Robert Marko wrote:
Currently, .clk_bit_rate is not being set in init_serial_data for debug UART, but its then used uart_dm_init() and this breaks debug UART on IPQ40xx.
So, lets populate .clk_bit_rate for debug UART as well. IPQ40xx requires special value of 0xff, so set it if ARCH_IPQ40XX is selected, otherwise default to the same value that regular DM UART will use.
Ah, I have a patch lying around to configure this automatically, but didn't get around to sending it. Could you give it a test on your IPQ board if I send it your way?
Kind regards,
Signed-off-by: Robert Marko robert.marko@sartura.hr
drivers/serial/serial_msm.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index 8044d38518..80069f5cfb 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -242,6 +242,11 @@ U_BOOT_DRIVER(serial_msm) = {
static struct msm_serial_data init_serial_data = { .base = CONFIG_VAL(DEBUG_UART_BASE), +#ifdef CONFIG_ARCH_IPQ40XX
- .clk_bit_rate = 0xff,
+#else
- .clk_bit_rate = UART_DM_CLK_RX_TX_BIT_RATE,
+#endif };
#include <debug_uart.h>

On Mon, Apr 15, 2024 at 1:46 PM Caleb Connolly caleb.connolly@linaro.org wrote:
On 15/04/2024 11:49, Robert Marko wrote:
Currently, .clk_bit_rate is not being set in init_serial_data for debug UART, but its then used uart_dm_init() and this breaks debug UART on IPQ40xx.
So, lets populate .clk_bit_rate for debug UART as well. IPQ40xx requires special value of 0xff, so set it if ARCH_IPQ40XX is selected, otherwise default to the same value that regular DM UART will use.
Ah, I have a patch lying around to configure this automatically, but didn't get around to sending it. Could you give it a test on your IPQ board if I send it your way?
Sure, that would be great. Regards, Robert
Kind regards,
Signed-off-by: Robert Marko robert.marko@sartura.hr
drivers/serial/serial_msm.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index 8044d38518..80069f5cfb 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -242,6 +242,11 @@ U_BOOT_DRIVER(serial_msm) = {
static struct msm_serial_data init_serial_data = { .base = CONFIG_VAL(DEBUG_UART_BASE), +#ifdef CONFIG_ARCH_IPQ40XX
.clk_bit_rate = 0xff,
+#else
.clk_bit_rate = UART_DM_CLK_RX_TX_BIT_RATE,
+#endif };
#include <debug_uart.h>
-- // Caleb (they/them)

Hi Robert,
Happy to see someone working on those IPQ platforms. If it makes sense to then I'd be happy to adopt them under ARCH_SNAPDRAGON at some point? I'm not hugely familiar with the usecase here (but eager to learn more!).
On 15/04/2024 11:49, Robert Marko wrote:
Currently, DEBUG_UART_MSM depends on ARCH_SNAPDRAGON only, but IPQ40XX devices also use the same UART HW so they can also use the debug UART.
So, allow selecting DEBUG_UART_MSM when using ARCH_IPQ40XX as well.
Signed-off-by: Robert Marko robert.marko@sartura.hr
Reviewed-by: Caleb Connolly caleb.connolly@linaro.org
drivers/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 8b19e2684e..1fe4607598 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -321,7 +321,7 @@ config DEBUG_UART_S5P
config DEBUG_UART_MSM bool "Qualcomm QUP UART debug"
- depends on ARCH_SNAPDRAGON
- depends on ARCH_SNAPDRAGON || ARCH_IPQ40XX help Select this to enable a debug UART using the serial_msm driver. You will need to provide parameters to make this work. The driver will

On Mon, Apr 15, 2024 at 1:21 PM Caleb Connolly caleb.connolly@linaro.org wrote:
Hi Robert,
Happy to see someone working on those IPQ platforms. If it makes sense to then I'd be happy to adopt them under ARCH_SNAPDRAGON at some point? I'm not hugely familiar with the usecase here (but eager to learn more!).
Well, IPQ40xx is quite a popular WiSoC family and its cheap but the stock bootloader limits any kind of custom use case, so here we are.
Regards, Robert
On 15/04/2024 11:49, Robert Marko wrote:
Currently, DEBUG_UART_MSM depends on ARCH_SNAPDRAGON only, but IPQ40XX devices also use the same UART HW so they can also use the debug UART.
So, allow selecting DEBUG_UART_MSM when using ARCH_IPQ40XX as well.
Signed-off-by: Robert Marko robert.marko@sartura.hr
Reviewed-by: Caleb Connolly caleb.connolly@linaro.org
drivers/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 8b19e2684e..1fe4607598 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -321,7 +321,7 @@ config DEBUG_UART_S5P
config DEBUG_UART_MSM bool "Qualcomm QUP UART debug"
depends on ARCH_SNAPDRAGON
depends on ARCH_SNAPDRAGON || ARCH_IPQ40XX help Select this to enable a debug UART using the serial_msm driver. You will need to provide parameters to make this work. The driver will
-- // Caleb (they/them)

On Mon, 15 Apr 2024 12:49:25 +0200, Robert Marko wrote:
Currently, DEBUG_UART_MSM depends on ARCH_SNAPDRAGON only, but IPQ40XX devices also use the same UART HW so they can also use the debug UART.
So, allow selecting DEBUG_UART_MSM when using ARCH_IPQ40XX as well.
Applied, thanks!
[1/3] serial: allow selecting MSM debug UART with ARCH_IPQ40XX commit: aa7fdad4c87d5c665e0f1b74cf7986768d452a4e [2/3] serial: msm_serial: remove .clk_rate from debug UART commit: aaba69b461ff7c3118272964d3a807a030277e28
Best regards,
participants (2)
-
Caleb Connolly
-
Robert Marko