1. 14 2月, 2017 7 次提交
    • H
      mmc: meson-gx: improve meson_mmc_irq_thread · 690f90b6
      Heiner Kallweit 提交于
      Remove unneeded variable ret and simplify the if block.
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Acked-by: NKevin Hilman <khilman@baylibre.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      690f90b6
    • H
      mmc: meson-gx: improve meson_mmc_clk_set · 5da86887
      Heiner Kallweit 提交于
      The following changes are quite small, therefore I combined them in
      one patch.
      
      - ret doesn't need to be initialized with 0
      - use standard !clk_rate notation to check for a zero value
      - If clk_rate is zero we return here. Therefore all further checks
        in this function for clk_rate != 0 are not needed.
      - switch from dev_warn to dev_err if the clock can't be set
      - If due to clock source and available divider values the requested
        frequency isn't matched exactly (always the case if requested
        frequency is 52 MHz), then just print the differing values as
        debug message and not as warning.
      - Also remove ret from the message as it is always 0.
      - Set member current_clock to the current requested rate and
        mmc->actual_clock to the current actual rate
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      5da86887
    • H
      mmc: meson-gx: minor improvements in meson_mmc_set_ios · 3d45c86f
      Heiner Kallweit 提交于
      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: NHeiner Kallweit <hkallweit1@gmail.com>
      Acked-by: NKevin Hilman <khilman@baylibre.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      3d45c86f
    • U
      mmc: meson: Assign the minimum clk rate as close to 400KHz as possible · a4c38c8d
      Ulf Hansson 提交于
      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: NUlf Hansson <ulf.hansson@linaro.org>
      [Heiner: Changed from 100KHz to 400KHz to get a proper rounded rate]
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      a4c38c8d
    • L
      mmc: core: start to break apart mmc_start_areq() · 37dac068
      Linus Walleij 提交于
      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: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      37dac068
    • L
      mmc: block: respect bool returned from blk_end_request() · 0e65f10c
      Linus Walleij 提交于
      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: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      0e65f10c
    • L
      mmc: block: return errorcode from mmc_sd_num_wr_blocks() · 169f03a0
      Linus Walleij 提交于
      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: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      [Ulf: Changed a return code to -EIO, reported by Dan Carpenter and fixed
      by Linus Walleij]
      169f03a0
  2. 13 2月, 2017 33 次提交