common: main: rework cmd timeout handling

The readline_from_buffer timeout functionality is broken in multiple ways.
If CONFIG_CMDLINE_EDITING is not enabled, the timeout value was never
used. If CONFIG_BOOT_RETRY_TIME is enabled, then that time is always used
and the specified timeout has no effect. The same (or what should be the
same) timeout code is duplicated in multiple places.

The new behavior is this: The user specified timeout passed to
readline_from_buffer is the timeout to get the 1st character. After that
the endtime value is used if enabled. For example, if 20 seconds is passed
in and the retry_time is 60 seconds, the user has 20 seconds to enter the
first character and 60 seconds to complete the input.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
1 file changed