1. 13 2月, 2017 16 次提交
  2. 25 12月, 2016 1 次提交
  3. 12 12月, 2016 1 次提交
    • U
      mmc: block: Move files to core · f397c8d8
      Ulf Hansson 提交于
      Once upon a time it made sense to keep the mmc block device driver and its
      related code, in its own directory called card. Over time, more an more
      functions/structures have become shared through generic mmc header files,
      between the core and the card directory. In other words, the relationship
      between them has become closer.
      
      By sharing functions/structures via generic header files, it becomes easy
      for outside users to abuse them. In a way to avoid that from happen, let's
      move the files from card directory into the core directory, as it enables
      us to move definitions of functions/structures into mmc core specific
      header files.
      
      Note, this is only the first step in providing a cleaner mmc interface for
      outside users. Following changes will do the actual cleanup, as that is not
      part of this change.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      f397c8d8
  4. 05 12月, 2016 3 次提交
  5. 29 11月, 2016 7 次提交
    • L
      mmc: block: delete packed command support · 03d640ae
      Linus Walleij 提交于
      I've had it with this code now.
      
      The packed command support is a complex hurdle in the MMC/SD block
      layer, around 500+ lines of code which was introduced in 2013 in
      
      commit ce39f9d1 ("mmc: support packed write command for eMMC4.5
      devices")
      commit abd9ac14 ("mmc: add packed command feature of eMMC4.5")
      
      ...and since then it has been rotting. The original author of the
      code has disappeared from the community and the mail address is
      bouncing.
      
      For the code to be exercised the host must flag that it supports
      packed commands, so in mmc_blk_prep_packed_list() which is called for
      every single request, the following construction appears:
      
      u8 max_packed_rw = 0;
      
      if ((rq_data_dir(cur) == WRITE) &&
          mmc_host_packed_wr(card->host))
              max_packed_rw = card->ext_csd.max_packed_writes;
      
      if (max_packed_rw == 0)
          goto no_packed;
      
      This has the following logical deductions:
      
      - Only WRITE commands can really be packed, so the solution is
        only half-done: we support packed WRITE but not packed READ.
        The packed command support has not been finalized by supporting
        reads in three years!
      
      - mmc_host_packed_wr() is just a static inline that checks
        host->caps2 & MMC_CAP2_PACKED_WR. The problem with this is
        that NO upstream host sets this capability flag! No driver
        in the kernel is using it, and we can't test it. Packed
        command may be supported in out-of-tree code, but I doubt
        it. I doubt that the code is even working anymore due to
        other refactorings in the MMC block layer, who would
        notice if patches affecting it broke packed commands?
        No one.
      
      - There is no Device Tree binding or code to mark a host as
        supporting packed read or write commands, just this flag
        in caps2, so for sure there are not any DT systems using
        it either.
      
      It has other problems as well: mmc_blk_prep_packed_list() is
      speculatively picking requests out of the request queue with
      blk_fetch_request() making the MMC/SD stack harder to convert
      to the multiqueue block layer. By this we get rid of an
      obstacle.
      
      The way I see it this is just cruft littering the MMC/SD
      stack.
      
      Cc: Namjae Jeon <namjae.jeon@samsung.com>
      Cc: Maya Erez <qca_merez@qca.qualcomm.com>
      Acked-by: NJaehoon Chung <jh80.chung@samsung.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      03d640ae
    • L
      mmc: block: move packed command struct init · e01071dd
      Linus Walleij 提交于
      By moving the mmc_packed_init() and mmc_packed_clean() into the
      only file in the kernel where they are used, we save two exported
      functions and can staticize those to the block.c file.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      e01071dd
    • L
      mmc: block: rename data to blkdata · 7db3028e
      Linus Walleij 提交于
      The struct mmc_blk_request contains an opaque void *data that
      is actually only used to store a pointer to a per-request
      struct mmc_blk_data. This is confusing, so rename the member
      to blkdata and forward-declare the block.c local struct.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      7db3028e
    • L
      mmc: block: use mmc_req_is_special() · f2818bff
      Linus Walleij 提交于
      Instead of open coding the check for the same thing that
      the helper checks: use the helper.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      f2818bff
    • L
      mmc: core: use enum mmc_blk_status properly · 8e8b3f51
      Linus Walleij 提交于
      There were several instances of code using the
      enum mmc_blk_status by arbitrarily converting it to an int and
      throwing it around to different functions. This makes the code
      hard to understand to may give rise to strange errors.
      
      Especially the function prototype mmc_start_req() had to be
      modified to take a pointer to an enum mmc_blk_status and the
      function pointer .err_check() inside struct mmc_async_req
      needed to return an enum mmc_blk_status.
      
      In every case: instead of assigning the block layer error code
      to an int, use the enum, also change the signature of all
      functions actually passing this enum to use the enum.
      
      To make it possible to use the enum everywhere applicable, move
      it to <linux/mmc/core.h> so that all code actually using it can
      also see it.
      
      An interesting case was encountered in the MMC test code which
      did not return a enum mmc_blk_status at all in the .err_check
      function supposed to check whether asynchronous requests worked
      or not: instead it returned a normal -ERROR or even the test
      frameworks internal error codes.
      
      The test code would also pass on enum mmc_blk_status codes as
      error codes inside the test code instead of converting them
      to the local RESULT_* codes.
      
      I have tried to fix all instances properly and run some tests
      on the result.
      
      Cc: Chunyan Zhang <zhang.chunyan@linaro.org>
      Cc: Baolin Wang <baolin.wang@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      8e8b3f51
    • L
      mmc: block: convert ecc_err to a bool · 2cc64587
      Linus Walleij 提交于
      The ecc_err flag is only assigned 0 or 1 and treated as a bool,
      so convert it to a bool.
      
      Cc: Chunyan Zhang <zhang.chunyan@linaro.org>
      Cc: Baolin Wang <baolin.wang@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      2cc64587
    • L
      mmc: block: make gen_err a bool variable · c44d6cef
      Linus Walleij 提交于
      This gen_err flag is only assigned 0 or 1 and treated as a bool,
      so convert it to a bool.
      
      Cc: Chunyan Zhang <zhang.chunyan@linaro.org>
      Cc: Baolin Wang <baolin.wang@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      c44d6cef
  6. 28 10月, 2016 1 次提交
  7. 10 10月, 2016 2 次提交
    • J
      mmc: core: Annotate cmd_hdr as __le32 · 3f2d2664
      Jiri Slaby 提交于
      Commit f68381a7 (mmc: block: fix packed command header endianness)
      correctly fixed endianness handling of packed_cmd_hdr in
      mmc_blk_packed_hdr_wrq_prep.
      
      But now, sparse complains about incorrect types:
      drivers/mmc/card/block.c:1613:27: sparse: incorrect type in assignment (different base types)
      drivers/mmc/card/block.c:1613:27:    expected unsigned int [unsigned] [usertype] <noident>
      drivers/mmc/card/block.c:1613:27:    got restricted __le32 [usertype] <noident>
      ...
      
      So annotate cmd_hdr properly using __le32 to make everyone happy.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Fixes: f68381a7 (mmc: block: fix packed command header endianness)
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      3f2d2664
    • B
      mmc: block: add missing header dependencies · 48ab086d
      Baoyou Xie 提交于
      We get 1 warning when building kernel with W=1:
      drivers/mmc/card/block.c:2147:5: warning: no previous prototype for
      'mmc_blk_issue_rq' [-Wmissing-prototypes]
      
      In fact, this function is declared in drivers/mmc/card/block.h, so this
      patch adds missing header dependencies.
      Signed-off-by: NBaoyou Xie <baoyou.xie@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      48ab086d
  8. 27 9月, 2016 3 次提交
    • L
      mmc: card: do away with indirection pointer · 29eb7bd0
      Linus Walleij 提交于
      We have enough vtables in the kernel as it is, we don't need
      this one to create even more artificial separation of concerns.
      
      As is proved by the Makefile:
      
      obj-$(CONFIG_MMC_BLOCK)         += mmc_block.o
      mmc_block-objs                  := block.o queue.o
      
      block.c and queue.c are baked into the same mmc_block.o object.
      So why would one of these objects access a function in the
      other object by dereferencing a pointer?
      
      Create a new block.h header file for the single shared function
      from block to queue and remove the function pointer and just
      call the queue request function.
      
      Apart from making the code more readable, this also makes link
      optimizations possible and probably speeds up the call as well.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      29eb7bd0
    • D
      mmc: block: don't use CMD23 with very old MMC cards · 0ed50abb
      Daniel Glöckner 提交于
      CMD23 aka SET_BLOCK_COUNT was introduced with MMC v3.1.
      Older versions of the specification allowed to terminate
      multi-block transfers only with CMD12.
      
      The patch fixes the following problem:
      
        mmc0: new MMC card at address 0001
        mmcblk0: mmc0:0001 SDMB-16 15.3 MiB
        mmcblk0: timed out sending SET_BLOCK_COUNT command, card status 0x400900
        ...
        blk_update_request: I/O error, dev mmcblk0, sector 0
        Buffer I/O error on dev mmcblk0, logical block 0, async page read
         mmcblk0: unable to read partition table
      Signed-off-by: NDaniel Glöckner <dg@emlix.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      0ed50abb
    • S
      mmc: block: remove the check of packed for packed request routine · 96e52daa
      Shawn Lin 提交于
      packed should always exist without calling its cleanup function
      explicitly. Moreover, we have use it when preparing packed list.
      So I don't believe we should ever fall into this check again when
      doing mmc_blk_packed_hdr_wrq_prep or mmc_blk_end_packed_req,etc.
      And the code of mmc_blk_end_packed_req is trying to use packed before
      checking it which makes it quite weird. This patch is trying to
      remove these two checks and move it to the mmc_blk_prep_packed_list.
      If we find packed is null, then we should never use MMC_BLK_PACKED_CMD.
      By doing this, we could fall back to non-packed request if finding null
      packed, though it's impossible theoretically.
      
      After removing these two BUG_ONs, we also remove all other similar
      checks within the routine of mmc_blk_issue_rw_rq which checks the
      error handling of packed request.
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      96e52daa
  9. 26 8月, 2016 1 次提交
  10. 16 8月, 2016 1 次提交
  11. 25 7月, 2016 3 次提交
  12. 18 7月, 2016 1 次提交
    • T
      mmc: block: fix packed command header endianness · f68381a7
      Taras Kondratiuk 提交于
      The code that fills packed command header assumes that CPU runs in
      little-endian mode. Hence the header is malformed in big-endian mode
      and causes MMC data transfer errors:
      
      [  563.200828] mmcblk0: error -110 transferring data, sector 2048, nr 8, cmd response 0x900, card status 0xc40
      [  563.219647] mmcblk0: packed cmd failed, nr 2, sectors 16, failure index: -1
      
      Convert header data to LE.
      Signed-off-by: NTaras Kondratiuk <takondra@cisco.com>
      Fixes: ce39f9d1 ("mmc: support packed write command for eMMC4.5 devices")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      f68381a7