RE: [PATCH v2 1/1] bsps/shared: Allow setting baud rate for zynq uart

2021-03-05 Thread Jan.Sommer



> -Original Message-
> From: Gedare Bloom 
> Sent: Friday, March 5, 2021 4:36 PM
> To: Sommer, Jan 
> Cc: devel@rtems.org
> Subject: Re: [PATCH v2 1/1] bsps/shared: Allow setting baud rate for zynq
> uart
> 
> On Mon, Feb 22, 2021 at 9:23 AM Jan Sommer  wrote:
> >
> > ---
> >  bsps/shared/dev/serial/zynq-uart.c | 14 +++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/bsps/shared/dev/serial/zynq-uart.c
> > b/bsps/shared/dev/serial/zynq-uart.c
> > index 8f17d3ca65..dd5a6e1cb8 100644
> > --- a/bsps/shared/dev/serial/zynq-uart.c
> > +++ b/bsps/shared/dev/serial/zynq-uart.c
> > @@ -144,14 +144,22 @@ static bool zynq_uart_set_attributes(  {
> >zynq_uart_context *ctx = (zynq_uart_context *) context;
> >volatile zynq_uart *regs = ctx->regs;
> > +  int32_t baud;
> >uint32_t brgr = 0;
> >uint32_t bauddiv = 0;
> >uint32_t mode = 0;
> >int rc;
> >
> > -  rc = zynq_cal_baud_rate(115200, , , regs->mode);
> > -  if (rc != 0)
> > -return rc;
> > +  /*
> > +   * Determine the baud rate
> > +   */
> > +  baud = rtems_termios_baud_to_number(term->c_ospeed);
> > +
> > +  if (baud > 0) {
> > +rc = zynq_cal_baud_rate(baud, , , regs->mode);
> > +if (rc != 0)
> > +  return rc;
> > +  }
> What happens if baud == 0?
> 

Ah, you are right. My initial goal was to leave it unchanged (because there are 
no modem control lines to deassert), but forgot that the baud rate registers 
are set below with then 0. That is not what it should be.
I will prepare a new patch with a condition.

Thanks.

> >
> >/*
> > * Configure the mode register
> > --
> > 2.17.1
> >
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v2 1/1] bsps/shared: Allow setting baud rate for zynq uart

2021-03-05 Thread Gedare Bloom
On Thu, Mar 4, 2021 at 1:11 AM  wrote:
>
> Could someone please have a look a this patch and approve it?
> Should I then still add a new section to the docs regarding the console 
> behavior for the zynq?
Please do prepare an addition for the docs, that would be great.

> With this patch applied it would be that the baud rate of the fsbl is 
> overwritten by default to 115200, but can be changed using the termios API 
> (compared to the currently unchangeable baud rate).
> I am not sure if that information is that useful or if people will figure 
> that out in 2 min anyways.

It is always best to be explicit when we can. This is most useful for
junior engineers, but even experts can get confused by some hidden
details.

>
> Best regards,
>
> Jan
>
> > -Original Message-
> > From: Sommer, Jan
> > Sent: Monday, February 22, 2021 5:23 PM
> > To: devel@rtems.org
> > Cc: Sommer, Jan 
> > Subject: [PATCH v2 1/1] bsps/shared: Allow setting baud rate for zynq uart
> >
> > ---
> >  bsps/shared/dev/serial/zynq-uart.c | 14 +++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/bsps/shared/dev/serial/zynq-uart.c
> > b/bsps/shared/dev/serial/zynq-uart.c
> > index 8f17d3ca65..dd5a6e1cb8 100644
> > --- a/bsps/shared/dev/serial/zynq-uart.c
> > +++ b/bsps/shared/dev/serial/zynq-uart.c
> > @@ -144,14 +144,22 @@ static bool zynq_uart_set_attributes(  {
> >zynq_uart_context *ctx = (zynq_uart_context *) context;
> >volatile zynq_uart *regs = ctx->regs;
> > +  int32_t baud;
> >uint32_t brgr = 0;
> >uint32_t bauddiv = 0;
> >uint32_t mode = 0;
> >int rc;
> >
> > -  rc = zynq_cal_baud_rate(115200, , , regs->mode);
> > -  if (rc != 0)
> > -return rc;
> > +  /*
> > +   * Determine the baud rate
> > +   */
> > +  baud = rtems_termios_baud_to_number(term->c_ospeed);
> > +
> > +  if (baud > 0) {
> > +rc = zynq_cal_baud_rate(baud, , , regs->mode);
> > +if (rc != 0)
> > +  return rc;
> > +  }
> >
> >/*
> > * Configure the mode register
> > --
> > 2.17.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v2 1/1] bsps/shared: Allow setting baud rate for zynq uart

2021-03-05 Thread Gedare Bloom
On Mon, Feb 22, 2021 at 9:23 AM Jan Sommer  wrote:
>
> ---
>  bsps/shared/dev/serial/zynq-uart.c | 14 +++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/bsps/shared/dev/serial/zynq-uart.c 
> b/bsps/shared/dev/serial/zynq-uart.c
> index 8f17d3ca65..dd5a6e1cb8 100644
> --- a/bsps/shared/dev/serial/zynq-uart.c
> +++ b/bsps/shared/dev/serial/zynq-uart.c
> @@ -144,14 +144,22 @@ static bool zynq_uart_set_attributes(
>  {
>zynq_uart_context *ctx = (zynq_uart_context *) context;
>volatile zynq_uart *regs = ctx->regs;
> +  int32_t baud;
>uint32_t brgr = 0;
>uint32_t bauddiv = 0;
>uint32_t mode = 0;
>int rc;
>
> -  rc = zynq_cal_baud_rate(115200, , , regs->mode);
> -  if (rc != 0)
> -return rc;
> +  /*
> +   * Determine the baud rate
> +   */
> +  baud = rtems_termios_baud_to_number(term->c_ospeed);
> +
> +  if (baud > 0) {
> +rc = zynq_cal_baud_rate(baud, , , regs->mode);
> +if (rc != 0)
> +  return rc;
> +  }
What happens if baud == 0?

>
>/*
> * Configure the mode register
> --
> 2.17.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


RE: [PATCH v2 1/1] bsps/shared: Allow setting baud rate for zynq uart

2021-03-04 Thread Jan.Sommer
Could someone please have a look a this patch and approve it?
Should I then still add a new section to the docs regarding the console 
behavior for the zynq?
With this patch applied it would be that the baud rate of the fsbl is 
overwritten by default to 115200, but can be changed using the termios API 
(compared to the currently unchangeable baud rate).
I am not sure if that information is that useful or if people will figure that 
out in 2 min anyways.

Best regards,

Jan

> -Original Message-
> From: Sommer, Jan
> Sent: Monday, February 22, 2021 5:23 PM
> To: devel@rtems.org
> Cc: Sommer, Jan 
> Subject: [PATCH v2 1/1] bsps/shared: Allow setting baud rate for zynq uart
> 
> ---
>  bsps/shared/dev/serial/zynq-uart.c | 14 +++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/bsps/shared/dev/serial/zynq-uart.c
> b/bsps/shared/dev/serial/zynq-uart.c
> index 8f17d3ca65..dd5a6e1cb8 100644
> --- a/bsps/shared/dev/serial/zynq-uart.c
> +++ b/bsps/shared/dev/serial/zynq-uart.c
> @@ -144,14 +144,22 @@ static bool zynq_uart_set_attributes(  {
>zynq_uart_context *ctx = (zynq_uart_context *) context;
>volatile zynq_uart *regs = ctx->regs;
> +  int32_t baud;
>uint32_t brgr = 0;
>uint32_t bauddiv = 0;
>uint32_t mode = 0;
>int rc;
> 
> -  rc = zynq_cal_baud_rate(115200, , , regs->mode);
> -  if (rc != 0)
> -return rc;
> +  /*
> +   * Determine the baud rate
> +   */
> +  baud = rtems_termios_baud_to_number(term->c_ospeed);
> +
> +  if (baud > 0) {
> +rc = zynq_cal_baud_rate(baud, , , regs->mode);
> +if (rc != 0)
> +  return rc;
> +  }
> 
>/*
> * Configure the mode register
> --
> 2.17.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 1/1] bsps/shared: Allow setting baud rate for zynq uart

2021-02-22 Thread Jan Sommer
---
 bsps/shared/dev/serial/zynq-uart.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/bsps/shared/dev/serial/zynq-uart.c 
b/bsps/shared/dev/serial/zynq-uart.c
index 8f17d3ca65..dd5a6e1cb8 100644
--- a/bsps/shared/dev/serial/zynq-uart.c
+++ b/bsps/shared/dev/serial/zynq-uart.c
@@ -144,14 +144,22 @@ static bool zynq_uart_set_attributes(
 {
   zynq_uart_context *ctx = (zynq_uart_context *) context;
   volatile zynq_uart *regs = ctx->regs;
+  int32_t baud;
   uint32_t brgr = 0;
   uint32_t bauddiv = 0;
   uint32_t mode = 0;
   int rc;
 
-  rc = zynq_cal_baud_rate(115200, , , regs->mode);
-  if (rc != 0)
-return rc;
+  /* 
+   * Determine the baud rate
+   */
+  baud = rtems_termios_baud_to_number(term->c_ospeed);
+
+  if (baud > 0) {
+rc = zynq_cal_baud_rate(baud, , , regs->mode);
+if (rc != 0)
+  return rc;
+  }
 
   /*
* Configure the mode register
-- 
2.17.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel