1. 14 Feb, 2017 5 commits
    • Heiner Kallweit's avatar
      mmc: meson-gx: minor improvements in meson_mmc_set_ios · 3d45c86f
      Heiner Kallweit authored
      val isn't used in the switch clause and afterwards there's an
      identical statement. So remove it.
      
      In case of an unexpected bus width the error message indicates
      the intention to set the bus width to 4 and to go on.
      So remove the return statement. This return statement also
      conflicts with "setting to 4" because nothing would be set
      actually before returning. 4bit bus width are chosen as
      default as the vendor driver does it too.
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Acked-by: default avatarKevin Hilman <khilman@baylibre.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      3d45c86f
    • Ulf Hansson's avatar
      mmc: meson: Assign the minimum clk rate as close to 400KHz as possible · a4c38c8d
      Ulf Hansson authored
      The current code dealing with calculating mmc->f_min is a bit complicated.
      Additionally, the attempt to set an initial clock rate should explicitly
      use a rate between 100KHz to 400 KHz, according the (e)MMC/SD specs, which
      it doesn't.
      
      Fix the problem and clean up the code by using clk_round_rate() to pick the
      nearest minimum rate to 400KHz (rounded down from 400kHz).
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      [Heiner: Changed from 100KHz to 400KHz to get a proper rounded rate]
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      a4c38c8d
    • Linus Walleij's avatar
      mmc: core: start to break apart mmc_start_areq() · 37dac068
      Linus Walleij authored
      This function is doing to many clever things at the same time under
      too many various conditions.
      
      Start to make things clearer by refactoring: break out the
      finalization of the previous asynchronous request to its own
      function mmc_finalize_areq(). We can get rid of the default
      assignment of status and let the call deal with this.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      37dac068
    • Linus Walleij's avatar
      mmc: block: respect bool returned from blk_end_request() · 0e65f10c
      Linus Walleij authored
      The return value from blk_end_request() is a bool but is
      treated like an int. This is generally safe, but the variable
      also has the opaque name "ret" and gets returned from the
      helper function mmc_blk_cmd_err().
      
      - Switch the variable to a bool, applies everywhere.
      
      - Return a bool from mmc_blk_cmd_err() and rename the function
        mmc_blk_rw_cmd_err() to indicate through the namespace that
        this is a helper for mmc_blk_issue_rw_rq().
      
      - Rename the variable from "ret" to "req_pending" inside the
        while() loop inside mmc_blk_issue_rq_rq(), which finally
        makes it very clear what this while loop is waiting for.
      
      - Augment the argument "ret" to mmc_blk_rq_cmd_err() to
        old_req_pending so it becomes evident that this is an
        older state, and it is returned only if we fail to get
        the number of written blocks from an SD card in the
        function mmc_sd_num_wr_blocks().
      
      - Augment the while() loop in mmc_blk_rq_cmd_abort(): it
        is evident now that we know this is a bool variable,
        that the function is just spinning waiting for
        blk_end_request() to return false.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      0e65f10c
    • Linus Walleij's avatar
      mmc: block: return errorcode from mmc_sd_num_wr_blocks() · 169f03a0
      Linus Walleij authored
      mmc_sd_num_wr_blocks() has an interesting construction that
      saves one return argument by casting (u32)-1 as error code
      if something goes wrong.
      
      This is however a bit confusing when the normal kernel
      pattern is to return an int error code on success.
      
      So instead pass a variable "blocks" that the function can
      fill in with the number of successfully transferred blocks
      and return an integer as error code.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      [Ulf: Changed a return code to -EIO, reported by Dan Carpenter and fixed
      by Linus Walleij]
      169f03a0
  2. 13 Feb, 2017 35 commits