All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vabhav Sharma <vabhav.sharma@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot-DM] [PATCH] drivers: serial: probe all serial devices
Date: Thu, 25 Oct 2018 13:51:23 +0000	[thread overview]
Message-ID: <VI1PR04MB48001E65CD3F477EC8CE6EB9F3F70@VI1PR04MB4800.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <d5de1ea4-bc67-920f-9068-9a621d4ec4a8@denx.de>

Hi Marek Vasut,
Apology for delayed reply, Occupied with other work

> -----Original Message-----
> From: Marek Vasut <marex@denx.de>
> Sent: Tuesday, October 16, 2018 2:39 PM
> To: Vabhav Sharma <vabhav.sharma@nxp.com>; u-boot at lists.denx.de; u-
> boot-dm at lists.denx.de; sjg at chromium.org
> Cc: yamada.masahiro at socionext.com; bmeng.cn at gmail.com; Andreas
> Dannenberg <dannenberg@ti.com>
> Subject: Re: [U-Boot-DM] [PATCH] drivers: serial: probe all serial devices
> 
> On 10/16/2018 09:20 AM, Vabhav Sharma wrote:
> >
> >
> >> -----Original Message-----
> >> From: Marek Vasut <marex@denx.de>
> >> Sent: Tuesday, October 16, 2018 12:29 PM
> >> To: Vabhav Sharma <vabhav.sharma@nxp.com>; u-boot at lists.denx.de;
> >> u-boot- dm at lists.denx.de; sjg at chromium.org
> >> Cc: yamada.masahiro at socionext.com; bmeng.cn at gmail.com
> >> Subject: Re: [U-Boot-DM] [PATCH] drivers: serial: probe all serial
> >> devices
> >>
> >> On 10/15/2018 02:09 AM, Vabhav Sharma wrote:
> >>> Serial subsystem search and probe only one first serial device and
> >>> unable to use remaining available UART devices
> >>
> >> The serial devices are bound and you can switch to them. What is the
> >> real problem ?
> > Yes, I understand switch is possible with change in DTS or platform data for
> choosing UART device to be used as boot console(e.g. UART0) with gd-
> >cur_serial_dev is updated to chosen UART device.
> > The problem was stated in email(attached 23 may) " [U-Boot-DM]
> QUERY:U-boot DM:SERIAL:Multiple On-chip UART Controller Support" with
> suggested solution from Simon which is sent as patch for review.
> > Similar issue was faced by Andreas
> 
> You can also use setenv stdin/stdout/stderr to alternate between stdio
> devices. So what is the problem ?
Problem is seen with PL011 driver using DM model, Only boot console baud rate is set.
Tried modifying the environment variable but seems readonly  (## Error inserting "stdout" variable, errno=22)
Multiple UART enablement is required to use all console.
> 
> >>> This patch changes the logic to probe all available serial devices
> >>> using platform data or device tree in DM model in order to use all
> >>> UART devices
> >>
> >> Get rid of the ifdeffery and copied code please.
> > This is case for using uclass_next_device() to iterate through them, Having
> CONFIG option doesn't make it mandatory for every platform to probe all
> serial devices.
> 
> Is this also the case for having 6 copies of exactly the same code ? You can
> turn it into a function if needed.
Ok, I understand
> 
> >>> Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
> >>> ---
> >>>  drivers/serial/Kconfig         | 12 ++++++++++++
> >>>  drivers/serial/serial-uclass.c | 42
> >>> ++++++++++++++++++++++++++++++++++++++++++
> >>>  2 files changed, 54 insertions(+)
> >>>
> >>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index
> >>> 597db4b..d6451b1 100644
> >>> --- a/drivers/serial/Kconfig
> >>> +++ b/drivers/serial/Kconfig
> >>> @@ -133,6 +133,18 @@ config SERIAL_SEARCH_ALL
> >>>
> >>>  	  If unsure, say N.
> >>>
> >>> +config SERIAL_PROBE_ALL
> >>> +	bool "Probe all available serial devices"
> >>> +	depends on DM_SERIAL
> >>> +	help
> >>> +	 The serial subsystem only probe for single serial device, but does
> >>> +	 not probe for remaining available devices.
> >>> +	 With this option set,we make probing for all available devices
> >>> +	 mandatory.
> >>> +
> >>> +	 If probing is not required for all remaining available
> >>> +	 devices other than default current console device, say N.
> >>> +
> >>>  config SPL_DM_SERIAL
> >>>  	bool "Enable Driver Model for serial drivers in SPL"
> >>>  	depends on DM_SERIAL && SPL_DM
> >>> diff --git a/drivers/serial/serial-uclass.c
> >>> b/drivers/serial/serial-uclass.c index e50f0aa..405e60e 100644
> >>> --- a/drivers/serial/serial-uclass.c
> >>> +++ b/drivers/serial/serial-uclass.c
> >>> @@ -82,6 +82,13 @@ static void serial_find_console_or_panic(void)
> >>>  		uclass_first_device(UCLASS_SERIAL, &dev);
> >>>  		if (dev) {
> >>>  			gd->cur_serial_dev = dev;
> >>> +#ifdef CONFIG_SERIAL_PROBE_ALL
> >>> +			/* Scanning uclass to probe all devices */
> >>> +			for (;
> >>> +			     dev;
> >>> +			     uclass_next_device(&dev))
> >>> +				;
> >>> +#endif
> >>>  			return;
> >>>  		}
> >>>  	} else if (CONFIG_IS_ENABLED(OF_CONTROL) && blob) { @@ -92,11
> >> +99,25
> >>> @@ static void serial_find_console_or_panic(void)
> >>>  			if (np
> >> && !uclass_get_device_by_ofnode(UCLASS_SERIAL,
> >>>  					np_to_ofnode(np), &dev)) {
> >>>  				gd->cur_serial_dev = dev;
> >>> +#ifdef CONFIG_SERIAL_PROBE_ALL
> >>> +				/* Scanning uclass to probe all devices */
> >>> +				for (;
> >>> +				     dev;
> >>> +				     uclass_next_device(&dev))
> >>> +					;
> >>> +#endif
> >>>  				return;
> >>>  			}
> >>>  		} else {
> >>>  			if (!serial_check_stdout(blob, &dev)) {
> >>>  				gd->cur_serial_dev = dev;
> >>> +#ifdef CONFIG_SERIAL_PROBE_ALL
> >>> +				/* Scanning uclass to probe all devices */
> >>> +				for (;
> >>> +				     dev;
> >>> +				     uclass_next_device(&dev))
> >>> +					;
> >>> +#endif
> >>>  				return;
> >>>  			}
> >>>  		}
> >>> @@ -121,6 +142,13 @@ static void serial_find_console_or_panic(void)
> >>>  		    !uclass_get_device(UCLASS_SERIAL, INDEX, &dev)) {
> >>>  			if (dev->flags & DM_FLAG_ACTIVATED) {
> >>>  				gd->cur_serial_dev = dev;
> >>> +#ifdef CONFIG_SERIAL_PROBE_ALL
> >>> +				/* Scanning uclass to probe all devices */
> >>> +				for (;
> >>> +				     dev;
> >>> +				     uclass_next_device(&dev))
> >>> +					;
> >>> +#endif
> >>>  				return;
> >>>  			}
> >>>  		}
> >>> @@ -132,6 +160,13 @@ static void serial_find_console_or_panic(void)
> >>>  			if (!ret) {
> >>>  				/* Device did succeed probing */
> >>>  				gd->cur_serial_dev = dev;
> >>> +#ifdef CONFIG_SERIAL_PROBE_ALL
> >>> +				/* Scanning uclass to probe all devices */
> >>> +				for (;
> >>> +				     dev;
> >>> +				     uclass_next_device(&dev))
> >>> +					;
> >>> +#endif
> >>>  				return;
> >>>  			}
> >>>  		}
> >>> @@ -140,6 +175,13 @@ static void serial_find_console_or_panic(void)
> >>>  		    !uclass_get_device(UCLASS_SERIAL, INDEX, &dev) ||
> >>>  		    (!uclass_first_device(UCLASS_SERIAL, &dev) && dev)) {
> >>>  			gd->cur_serial_dev = dev;
> >>> +#ifdef CONFIG_SERIAL_PROBE_ALL
> >>> +			/* Scanning uclass to probe all devices */
> >>> +			for (;
> >>> +			     dev;
> >>> +			     uclass_next_device(&dev))
> >>> +				;
> >>> +#endif
> >>>  			return;
> >>>  		}
> >>>  #endif
> >>>
> >>
> >>
> >> --
> >> Best regards,
> >> Marek Vasut
> 
> 
> --
> Best regards,
> Marek Vasut

  reply	other threads:[~2018-10-25 13:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15  0:09 [U-Boot] [PATCH] drivers: serial: probe all serial devices Vabhav Sharma
2018-10-15 12:28 ` Bin Meng
2018-10-16  7:23   ` Vabhav Sharma
2018-10-19  3:25   ` Simon Glass
2018-10-25 14:00     ` Vabhav Sharma
2018-10-25 14:24     ` Bin Meng
2018-10-16  6:59 ` [U-Boot] [U-Boot-DM] " Marek Vasut
2018-10-16  7:20   ` Vabhav Sharma
2018-10-16  9:09     ` Marek Vasut
2018-10-25 13:51       ` Vabhav Sharma [this message]
2018-10-25 14:04         ` Wolfgang Denk
2018-10-25 14:19           ` Vabhav Sharma
2018-10-26 11:26             ` Wolfgang Denk
2018-11-02  8:40               ` Vabhav Sharma
2018-11-02 10:07                 ` [U-Boot] " Wolfgang Denk

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=VI1PR04MB48001E65CD3F477EC8CE6EB9F3F70@VI1PR04MB4800.eurprd04.prod.outlook.com \
    --to=vabhav.sharma@nxp.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.