19 Jun, 2014

28 commits


12 Jun, 2014

12 commits

  • Tom Rini
     
  • Cleanup to balance malloc/free calls.

    Signed-off-by: Darwin Rambo
    Reviewed-by: Steve Rae
    Acked-by: Pantelis Antoniou

    Darwin Rambo
     
  • Currently, U-Boot behaves as follows:

    - Begin with no SD card inserted in "mmc 1"
    - Execute: mmc dev 1
    - This fails, since there is no card
    - User plugs in an SD card
    - Execute: mmc dev 1
    - This still fails, since the HW isn't reprobed.

    With this change, U-Boot behaves as follows:

    - Begin with no SD card inserted in "mmc 1"
    - Execute: mmc dev 1
    - This fails, since there is no card
    - User plugs in an SD card
    - Execute: mmc dev 1
    - The newly present SD card is detected

    I know that "mmc rescan" will force the HW to be reprobed, but I feel it
    makes more sense if "mmc dev" always reprobes the HW after selecting the
    current MMC device. This allows scripts to just execute "mmc dev", and
    not have to also execute "mmc rescan" to check for media presense.

    Signed-off-by: Stephen Warren
    Acked-by: Pantelis Antoniou

    Stephen Warren
     
  • The body of init_mmc_device() is now identical to that of do_mmc_rescan()
    except for the error codes returned. Modify do_mmc_rescan() to simply
    call init_mmc_device() and convert the error codes, to avoid code
    duplication.

    Signed-off-by: Stephen Warren
    Acked-by: Pantelis Antoniou

    Stephen Warren
     
  • This allows callers to inject mmc->has_init = 0 between finding the
    MMC device, and calling mmc_init(), which forces mmc_init() to rescan
    the HW. Future changes will use this feature.

    Signed-off-by: Stephen Warren
    Acked-by: Jaehoon Chung
    Acked-by: Pantelis Antoniou

    Stephen Warren
     
  • Currently, get_device()/get_dev_hwpart() for MMC devices does not select
    an explicit HW partition unless the user explicitly requests one, i.e. by
    requesting device "mmc 0.0" rather than just "mmc 0". I think it makes
    more sense if the default is to select HW partition 0 (main data area)
    if the user didn't request a specific partition. Otherwise, the following
    happens, which feels wrong:

    Select HW partition 1 (boot0):
    mmc dev 0 1

    Attempts to access SW partition 1 on HW partition 1 (boot0), rather than
    SW partition 1 on HW partition 0 (main data area):
    ls mmc 0:1 /

    With this patch, the second command above re-selects the main data area.

    Many device types don't support HW partitions at all, so if HW partition
    0 is selected (either explicitly or as the default) and there's no
    select_hwpart function, we simply skip attempting to select a HW
    partition.

    Some MMC devices (i.e. SD cards) don't support HW partitions. However,
    this patch still works, since mmc_start_init() sets the current
    partition number to 0, and mmc_select_hwpart() succeeds if the requested
    partition is already selected.

    Signed-off-by: Stephen Warren
    Acked-by: Pantelis Antoniou

    Stephen Warren
     
  • Currently, "mmc dev 0" does not change the selected HW partition. I
    think it makes more sense if "mmc dev 0" is an alias for "mmc dev 0 0",
    i.e. that HW partition 0 (main data area) is always selected by default
    if the user didn't request a specific partition. Otherwise, the following
    happens, which feels wrong:

    Select HW partition 1 (boot0):
    mmc dev 0 1

    Doesn't change the HW partition, so it's still 1 (boot0):
    mmc dev 0

    With this patch, the second command above re-selects the main data area.

    Note that some MMC devices (i.e. SD cards) don't support HW partitions.
    However, this patch still works, since mmc_start_init() sets the current
    partition number to 0, and mmc_select_hwpart() succeeds if the requested
    partition is already selected.

    Signed-off-by: Stephen Warren
    Acked-by: Pantelis Antoniou

    Stephen Warren
     
  • Rather than just returning -1 everywhere, try to return something
    meaningful from mmc_select_hwpart(). Note that most other MMC functions
    don't do this, including functions called from mmc_select_hwpart(), so
    I'm not sure how effective this will be. Still, it's one less place with
    hard-coded -1.

    Suggested-by: Pantelis Antoniou
    Signed-off-by: Stephen Warren
    Acked-by: Pantelis Antoniou

    Stephen Warren
     
  • - "i2c mw" command hangs (with some compilers)

    Signed-off-by: Steve Rae

    Steve Rae
     
  • To prevent a warning for clang the loop without a body
    is made more clear by moving it to a line of its own.
    This prevents a clang warning.

    cc: sbabic@denx.de
    Signed-off-by: Jeroen Hofstee

    Jeroen Hofstee
     
  • Clang interpretes an if condition like  "if ((a = b) == NULL)
    as it tries to assign a value in a statement. Hence if you do
    "if ((something)) it warns you that you might be confused.
    Hence drop the double braces for plane if statements.

    Signed-off-by: Jeroen Hofstee

    Jeroen Hofstee
     
  • Clang interpretes an if condition like "if ((a = b) == NULL)
    as it tries to assign a value in a statement. Hence if you do
    "if ((something)) it warns you that you might be confused.
    Hence drop the double braces for plane if statements.

    cc: Holger Brunck
    Signed-off-by: Jeroen Hofstee

    Jeroen Hofstee