mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>, barebox@lists.infradead.org
Subject: Re: [PATCH RESEND v4 3/8] console: support set baudrate for fixed baudrate drivers
Date: Mon, 23 Aug 2021 14:01:52 +0200	[thread overview]
Message-ID: <b8bd0c12-c757-dfd1-188a-e9c261eb0f55@pengutronix.de> (raw)
In-Reply-To: <20210817101104.114945-4-antonynpavlov@gmail.com>

On 17.08.21 12:10, Antony Pavlov wrote:
> There are console drivers (linux, virtio, litex)
> that don't support baud rate setting and has
> no setbrg (set baudrate) callback, so
> console_set_baudrate() returns -ENOSYS.
> 
> At the other hand console_set_baudrate() SUCCESS
> return value is needed for the loadx/loady commands
> correct work.
> 
> See discussion here:
> 
>   http://lists.infradead.org/pipermail/barebox/2021-May/036237.html
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  common/console.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/common/console.c b/common/console.c
> index ad1a6aaab2..c902239e31 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -165,12 +165,12 @@ int console_set_baudrate(struct console_device *cdev, unsigned baudrate)
>  	int ret;
>  	unsigned char c;
>  
> -	if (!cdev->setbrg)
> -		return -ENOSYS;
> -
>  	if (cdev->baudrate == baudrate)
>  		return 0;
>  
> +	if (!cdev->setbrg)
> +		return -ENOSYS;
> +
>  	/*
>  	 * If the device is already active, change its baudrate.
>  	 * The baudrate of an inactive device will be set at activation time.
> @@ -336,11 +336,13 @@ int console_register(struct console_device *newcdev)
>  		ret = newcdev->setbrg(newcdev, baudrate);
>  		if (ret)
>  			return ret;
> -		newcdev->baudrate_param = newcdev->baudrate = baudrate;
> +		newcdev->baudrate_param = baudrate;
>  		dev_add_param_uint32(dev, "baudrate", console_baudrate_set,
>  			NULL, &newcdev->baudrate_param, "%u", newcdev);
>  	}
>  
> +	newcdev->baudrate = baudrate;
> +
>  	if (newcdev->putc && !newcdev->puts)
>  		newcdev->puts = __console_puts;
>  
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2021-08-23 12:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 10:10 [PATCH RESEND v4 0/8] RISC-V: add LiteX SoC support Antony Pavlov
2021-08-17 10:10 ` [PATCH RESEND v4 1/8] clocksource: timer-riscv: select CSR from device tree Antony Pavlov
2021-08-23 12:08   ` Ahmad Fatoum
2021-08-31  4:07     ` Antony Pavlov
2021-10-01 10:12       ` Ahmad Fatoum
2021-08-17 10:10 ` [PATCH RESEND v4 2/8] serial: add litex UART driver Antony Pavlov
2021-08-23 11:58   ` Ahmad Fatoum
2021-08-17 10:10 ` [PATCH RESEND v4 3/8] console: support set baudrate for fixed baudrate drivers Antony Pavlov
2021-08-23 12:01   ` Ahmad Fatoum [this message]
2021-08-17 10:11 ` [PATCH RESEND v4 4/8] gpio: add driver for 74xx-ICs with MMIO access Antony Pavlov
2021-10-01 10:13   ` Ahmad Fatoum
2021-08-17 10:11 ` [PATCH RESEND v4 5/8] spi: add litex spiflash driver Antony Pavlov
2021-08-23 11:57   ` [PATCH] fixup! " Ahmad Fatoum
2021-10-01 10:13   ` [PATCH RESEND v4 5/8] " Ahmad Fatoum
2021-08-17 10:11 ` [PATCH RESEND v4 6/8] net: add LiteEth driver Antony Pavlov
2021-10-01 10:14   ` Ahmad Fatoum
2021-08-17 10:11 ` [PATCH RESEND v4 7/8] RISC-V: add LiteX SoC and linux-on-litex-vexriscv support Antony Pavlov
2021-08-23 12:06   ` Ahmad Fatoum
2021-08-31  4:38     ` Antony Pavlov
2021-10-01 10:21       ` Ahmad Fatoum
2021-08-17 10:11 ` [PATCH RESEND v4 8/8] RISC-V: add litex_linux_defconfig Antony Pavlov
2021-10-01 10:18   ` Ahmad Fatoum
2021-10-04 12:02 ` [PATCH RESEND v4 0/8] RISC-V: add LiteX SoC support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8bd0c12-c757-dfd1-188a-e9c261eb0f55@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox