On Tue, 25 May 2021 10:19:47 +0300
Antony Pavlov <[email protected]> wrote:

Hi all!


> From: Marek Czerski <[email protected]>
> 
> setbrg callback (set baudrate) is needed by the loadx/loady commands.
> Because litex serial has fixed baudrate the callback only checks if
> the requested baudrate is the same as the CONFIG_BAUDRATE.
> ---
>  drivers/serial/serial_litex.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/serial/serial_litex.c b/drivers/serial/serial_litex.c
> index 8562a45ecc..9d35a6e44a 100644
> --- a/drivers/serial/serial_litex.c
> +++ b/drivers/serial/serial_litex.c
> @@ -58,6 +58,13 @@ static int litex_serial_tstc(struct console_device *cdev)
>       return !litex_serial_readb(cdev, UART_RXEMPTY);
>  }
>  
> +static int litex_setial_setbaudrate(struct console_device *cdev, int 
> baudrate)
> +{
> +     if (baudrate != CONFIG_BAUDRATE)
> +             return -EINVAL;
> +     return 0;
> +}
> +

I have sent this patch separately because it need special attention.

LiteX serial port hardware has fixed baudrate and setbaudrate has no sence.
On the other hand absent setnbaudrate() litex serial makes impossible 
to use Y-modem data trasfer.

I don't like CONFIG_BAUDRATE here. Can we use 

        if (baudrate != cdev->baudrate)
                return -EINVAL;
        return 0;

instead?

Please comment!

To: Ahmad
It looks like CONFIG_BAUDRATE is a one more global defconfig parameter
that complicates "one defconfig for all RISC-V boards" approach.

P.S. There is typo in litex_seTial_setbaudrate name. I have noted just now.
It should be fixed of cause.


>  static int litex_serial_probe(struct device_d *dev)
>  {
>       struct resource *iores;
> @@ -73,7 +80,7 @@ static int litex_serial_probe(struct device_d *dev)
>       cdev->tstc = &litex_serial_tstc;
>       cdev->putc = &litex_serial_putc;
>       cdev->getc = &litex_serial_getc;
> -     cdev->setbrg = NULL;
> +     cdev->setbrg = &litex_setial_setbaudrate;
>  
>       console_register(cdev);
>  
> -- 
> 2.31.1
> 


-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to