serial: Make full device search optional
authorAlexander Graf <agraf@suse.de>
Mon, 29 Jan 2018 12:57:20 +0000 (13:57 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 29 Jan 2018 13:18:02 +0000 (08:18 -0500)
Commit 608b0c4ad4e5ec0c ("serial: Use next serial device if probing fails")
added code to search for more serial devices if the default one was not
probed correctly.

Unfortunately, that breaks omap3_evm. So while investigating why that is
the case, let's disable the full search for everyone but bcm283x where it
is needed.

Fixes: 608b0c4ad4e5ec0c ("serial: Use next serial device if probing fails")
Reported-by: Derald D. Woods <woods.technical@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/arm/Kconfig
drivers/serial/Kconfig
drivers/serial/serial-uclass.c

index 30a6f6dc538a9d3886b1b0aadae5ae2902b2f519..a423aa96296cfb6f86e55de467599eb38df9c78e 100644 (file)
@@ -550,6 +550,7 @@ config ARCH_BCM283X
        select DM_GPIO
        select OF_CONTROL
        select PL01X_SERIAL
+       select SERIAL_SEARCH_ALL
        imply FAT_WRITE
 
 config TARGET_VEXPRESS_CA15_TC2
index 3ffedba525657ea587882562daa9c2b81dca8217..93e602e0ee0edfabfd79943843e20b688d8672fe 100644 (file)
@@ -79,6 +79,18 @@ config SERIAL_RX_BUFFER_SIZE
        help
          The size of the RX buffer (needs to be power of 2)
 
+config SERIAL_SEARCH_ALL
+       bool "Search for serial devices after default one failed"
+       depends on DM_SERIAL
+       help
+         The serial subsystem only searches for a single serial device
+         that was instantiated, but does not check whether it was probed
+         correctly. With this option set, we make successful probing
+         mandatory and search for fallback serial devices if the default
+         device does not work.
+
+         If unsure, say N.
+
 config SPL_DM_SERIAL
        bool "Enable Driver Model for serial drivers in SPL"
        depends on DM_SERIAL
index 68ca2d09d1b30a9054e2021538366cd90f4a6c1f..9891c20656f4d248433e46fa3771253d9714331d 100644 (file)
@@ -74,7 +74,9 @@ static void serial_find_console_or_panic(void)
 {
        const void *blob = gd->fdt_blob;
        struct udevice *dev;
+#ifdef CONFIG_SERIAL_SEARCH_ALL
        int ret;
+#endif
 
        if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
                uclass_first_device(UCLASS_SERIAL, &dev);
@@ -113,6 +115,8 @@ static void serial_find_console_or_panic(void)
 #else
 #define INDEX 0
 #endif
+
+#ifdef CONFIG_SERIAL_SEARCH_ALL
                if (!uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) ||
                    !uclass_get_device(UCLASS_SERIAL, INDEX, &dev)) {
                        if (dev->flags & DM_FLAG_ACTIVATED) {
@@ -131,6 +135,15 @@ static void serial_find_console_or_panic(void)
                                return;
                        }
                }
+#else
+               if (!uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) ||
+                   !uclass_get_device(UCLASS_SERIAL, INDEX, &dev) ||
+                   (!uclass_first_device(UCLASS_SERIAL, &dev) && dev)) {
+                       gd->cur_serial_dev = dev;
+                       return;
+               }
+#endif
+
 #undef INDEX
        }