All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH resend 1/2] config_distro_bootcmd.h: Allow user to indicate that usb is inited in preboot
Date: Fri, 12 Dec 2014 11:10:52 -0700	[thread overview]
Message-ID: <548B2FAC.1020909@wwwdotorg.org> (raw)
In-Reply-To: <1418406612-3243-2-git-send-email-hdegoede@redhat.com>

On 12/12/2014 10:50 AM, Hans de Goede wrote:
> When using usb-keyboard support, typically usb will already get started from
> preboot. In this case doing it again in the bootcmd is undesirable.
>
> Allow the user of config_distro_bootcmd to indicate that usb is inited in
> preboot through the user setting BOOTENV_PREBOOT_INITS_USB.

Sorry, I don't recall seeing this whenever it was posted before.

Conceptually this seems fine. One issue it has is with the following 
sequence:

PREBOOT inits USB, no USB drive found (not plugged in)
User CTRL-Cs boot sequence
User plugs in USB drive
User runs "boot" or "run bootcmd"
-> USB not re-detected, so system doesn't boot from USB.

Perhaps the best way to solve this is to have a flag controlling whether 
BOOTENV_SET_USB_NEED_INIT sets $usb_need_init?

preboot:
setenv usb_do_set_usb_need_init false

BOOTENV_SET_USB_NEED_INIT:
# Normally unset -> true
# In your case, preboot sets this to false
if ${usb_do_set_usb_need_init}; then
     setenv usb_need_init
else
     # Next time $boot is run, this will be unset -> true
     # so we will re-init USB
     setenv usb_do_set_usb_need_init
     # This time through, we skip USB init
     setenv usb_need_init false
endif

Of course, that doesn't solve the problem of the user aborting auto-boot 
before it's ever run once. Perhaps better would be a flag that 
BOOTENV_SET_USB_NEED_INIT can use to distinguish auto-boot and manual 
invocation, i.e.:

preboot:
setenv usb_do_set_usb_need_init false

BOOTENV_SET_USB_NEED_INIT:
# U-Boot C code sets this appropriatelyL
if ${auto_boot}; then
     # Auto case: Init USB unless preboot set a flag
     if ${usb_do_set_usb_need_init}; then
         setenv usb_need_init
     else
         # Next time $boot is run, this will be unset -> true
         # so we will re-init USB
         setenv usb_do_set_usb_need_init
         # This time through, we skip USB init
         setenv usb_need_init false
     endif
else
     # Manual case: Always init USB
     setenv usb_need_init
endif

Or do we just assume that if the user plugs in a new USB device after 
boot, they must manually run USB initialization? If so, we cam simplify 
the existing $usb_need_init a bit...

  reply	other threads:[~2014-12-12 18:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12 17:50 [U-Boot] [PATCH resend 0/2] config_distro_bootcmd: Avoid usb getting scanned tw Hans de Goede
2014-12-12 17:50 ` [U-Boot] [PATCH resend 1/2] config_distro_bootcmd.h: Allow user to indicate that usb is inited in preboot Hans de Goede
2014-12-12 18:10   ` Stephen Warren [this message]
2014-12-18  9:00   ` [U-Boot] [U-Boot, resend, " Hans de Goede
2014-12-12 17:50 ` [U-Boot] [PATCH resend 2/2] sunxi: Avoid usb getting scanned twice when using usb kbd + usb boot Hans de Goede
2014-12-13 16:52   ` Ian Campbell

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=548B2FAC.1020909@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --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.