Does uart_pl011.c support non interrupt mode


Ayan Kumar Halder <ayankuma@...>
 

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 ?

Appreciate any help.

Kind regards,

Ayan


Jaxson Han <Jaxson.Han@...>
 

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 */

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.


Ayan Kumar Halder <ayankuma@...>
 

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 ?

- 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.


Jaxson Han <Jaxson.Han@...>
 

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 :)

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.


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.


Jaxson Han <Jaxson.Han@...>
 

Hi Luca,

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



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?
Usually, we open an issue to describe it and then fix it with a PR. But it's so small
that I think it's enough just tagging him directly in the PR description. :)
Anyway, it's up to you~

Jaxson


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.


Ayan Kumar Halder <ayankuma@...>
 

Hi Jaxson/Luca,

Thanks for your feedback.

On 03/08/2022 07:42, Jaxson Han wrote:
Hi Luca,

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



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?
Usually, we open an issue to describe it and then fix it with a PR. But it's so small
that I think it's enough just tagging him directly in the PR description. :)
Anyway, it's up to you~
I have created a pull request https://github.com/zephyrproject-rtos/zephyr/pull/48706

As it is my first patch to Zephyr, please let me know if there is any mistake in the workflow.

While running 'twister' (https://docs.zephyrproject.org/latest/contribute/guidelines.html#twister), I noticed a failure.

/scratch/ayankuma/zephyr/zephyrproject/modules/hal/altera/altera_hal/HAL/src/altera_common.c:77:10: fatal error: kernel.h: No such file or directory
   77 | #include <kernel.h>

I think this is unrelated to my changes.

- Ayan


Jaxson

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.


Jaxson Han <Jaxson.Han@...>
 

Hi Ayan,

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

Hi Jaxson/Luca,

Thanks for your feedback.

On 03/08/2022 07:42, Jaxson Han wrote:
Hi Luca,

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



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?
Usually, we open an issue to describe it and then fix it with a PR.
But it's so small that I think it's enough just tagging him directly
in the PR description. :) Anyway, it's up to you~
I have created a pull request
https://github.com/zephyrproject-rtos/zephyr/pull/48706

As it is my first patch to Zephyr, please let me know if there is any mistake in the
workflow.

While running 'twister'
(https://docs.zephyrproject.org/latest/contribute/guidelines.html#twister),
I noticed a failure.

/scratch/ayankuma/zephyr/zephyrproject/modules/hal/altera/altera_hal/HAL/s
rc/altera_common.c:77:10:
fatal error: kernel.h: No such file or directory
77 | #include <kernel.h>

I think this is unrelated to my changes.
Right, sounds like you forget to west update. But never mind, I trigger the CI, so let's see what happens. :)

Jaxson


- Ayan


Jaxson

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.
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.