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 ? > 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. > Signed-off-by: Vabhav Sharma <vabhav.sha...@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 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot