Re: Does uart_pl011.c support non interrupt mode


Luca Fancellu <Luca.Fancellu@...>
 

On 3 Aug 2022, at 06:42, Jaxson Han <Jaxson.Han@...> wrote:

Hi Ayan,

-----Original Message-----
From: Ayan Kumar Halder <ayankuma@...>
Sent: Tuesday, August 2, 2022 6:51 PM
To: Jaxson Han <Jaxson.Han@...>; users@...;
daniel.leung@...
Cc: Stabellini, Stefano <stefano.stabellini@...>;
michalorzel.eng@...; Luca Fancellu <Luca.Fancellu@...>
Subject: Re: Does uart_pl011.c support non interrupt mode

Hi Jaxson,

On 02/08/2022 11:03, Jaxson Han wrote:
Hi Ayan,

-----Original Message-----
From: Ayan Kumar Halder <ayankuma@...>
Sent: Tuesday, August 2, 2022 5:23 PM
To: users@...; daniel.leung@...; Jaxson Han
<Jaxson.Han@...>
Cc: Stabellini, Stefano <stefano.stabellini@...>;
michalorzel.eng@...; Luca Fancellu <Luca.Fancellu@...>
Subject: Does uart_pl011.c support non interrupt mode

Hi Zephyr Users,

When I try to compile with fvp_baser_armv8r_aarch32_defconfig and
CONFIG_UART_INTERRUPT_DRIVEN=n, I get the following compilation
error

/home/ayan/zephyrproject/zephyr/drivers/serial/uart_

pl011.c:474:4: error: 'struct pl011_config' has no member named 'uart'
474 | .uart = (volatile struct pl011_regs *)DT_INST_REG_ADDR(n), \

I fixed this error using the following diff

ayan@ayan-Lenovo-V15-IIL:~/zephyrproject/zephyr$ git diff
drivers/serial/uart_pl011.c diff --git a/drivers/serial/uart_pl011.c
b/drivers/serial/uart_pl011.c index d00d805f..636d2fcf 100644
--- a/drivers/serial/uart_pl011.c
+++ b/drivers/serial/uart_pl011.c
@@ -49,7 +49,9 @@ struct pl011_config {
uint32_t sys_clk_freq;
#ifdef CONFIG_UART_INTERRUPT_DRIVEN uart_irq_config_func_t
irq_config_func; -#endif
+#else /* CONFIG_UART_INTERRUPT_DRIVEN */
+ volatile struct pl011_regs *uart; #endif /*
+CONFIG_UART_INTERRUPT_DRIVEN */
};


But I do not get any serial output.

So, does uart_pl011 support non interrupt mode ? Or is there some
issue with my diff ?
Sure, it does support.
You may try this:

diff --git a/drivers/serial/uart_pl011.c b/drivers/serial/uart_pl011.c
index d00d805f10..a39a562946 100644
--- a/drivers/serial/uart_pl011.c
+++ b/drivers/serial/uart_pl011.c
@@ -467,7 +467,7 @@ void pl011_isr(const struct device *dev)
#else
#define PL011_CONFIG_PORT(n) \
static struct pl011_config pl011_cfg_port_##n = { \
- .uart = (volatile struct pl011_regs *)DT_INST_REG_ADDR(n),
\
+ DEVICE_MMIO_ROM_INIT(DT_DRV_INST(n)), \
.sys_clk_freq = DT_INST_PROP_BY_PHANDLE(n, clocks,
clock_frequency), \
};
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */
Many thanks for this. It worked. :-)

Will you send a patch for this fix ?
Emmm, you could send a patch if you like :)
Hi all,

I think this was my mistake, I refactored the pl011 code to use the new driver model and I missed that change!

So you can send a patch to fix it or I can send it, does GitHub has tags like “Suggested-by”, to mention that
You spotted the problem?

Cheers,
Luca


Jaxson


- Ayan


Regards,
Jaxson

Appreciate any help.

Kind regards,

Ayan
IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium. Thank you.
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Join users@lists.zephyrproject.org to automatically receive all group messages.