• Stephen Warren's avatar
    ARM: tegra: uncompress.h: Choose a UART at runtime · fe263989
    Stephen Warren authored
    With this change we automatically detect which UART to use for
    for printing during decompression. The detection involves coordination
    with the bootloader: it's expected that the bootloader will leave a
    'D' (for [D]ebug) in the UART scratchpad register for whichever UART we
    should use for debugging.
    
    If we don't find any such UART, we fall back to the UART that was
    specified during config time: CONFIG_TEGRA_DEBUG_UART_XXX.
    
    As a side effect of this change, uncompress debug messages will work
    if you've specified CONFIG_TEGRA_DEBUG_UART_NONE, provided the
    bootloader obeys the protocol.
    
    This change is in line with what is documented in
    Documentation/arm/Booting.
    
    Other approaches considered:
    * Hardcode based on machine ID (as many other ARM boards do).
      OK, but nice to not have yet another place to add per-board
      code. Better to have bootloader parse device tree and pass us
      this info.
    * Check for TXE bit (like SA1110). Nice (and doesn't require
      a bootloader change), but a little less explicit. Also: if
      bootloader (for some reason) uses another UART, it needs to
      remember to turn it off before jumping to the kernel or we may
      print to it. NOTE: adapting this patch to check TXE too would
      be easy if desired.
    Signed-off-by: default avatarDoug Anderson <dianders@chromium.org>
    [swarren: Added clock/reset condition checks]
    Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
    Tested-by: default avatarDoug Anderson <dianders@chromium.org>
    Acked-by: default avatarDoug Anderson <dianders@chromium.org>
    Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
    fe263989
uncompress.h 3.3 KB