27 Sep, 2016

33 commits

  • Dwmmc host controller may in unknown state when entering kernel boot. One
    example is when booting from eMMC, bootloader need initialize MMC host
    controller into some state so it can read. In order to make sure MMC host
    controller in a clean initial state, this reset support is added.

    With this patch, a 'resets' property can be added into dw_mmc device
    tree node. The hardware logic is: dwmmc host controller IP receives a reset
    signal from a 'reset provider' (eg. power management unit). The 'resets'
    property points to this reset signal. So, during dwmmc driver probe,
    it can use this signal to reset itself.

    Refer to [1] for more information.

    [1] Documentation/devicetree/bindings/reset/reset.txt

    Signed-off-by: Guodong Xu
    Signed-off-by: Xinwei Kong
    Signed-off-by: Zhangfei Gao
    Reviewed-by: Shawn Lin
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Guodong Xu
     
  • Add resets property to synopsys-dw-mshc bindings. It is intended to
    represent the hardware reset signal present internally in some host
    controller IC designs.

    See Documentation/devicetree/bindings/reset/reset.txt for details.

    Signed-off-by: Guodong Xu
    Reviewed-by: Shawn Lin
    Acked-by: Rob Herring
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Guodong Xu
     
  • If ciu/biu clock are NULL, clk_disable_unprepare should be just
    returned. In clk_disable_unprepare(), already checked whether clk is
    error or NULL.

    Signed-off-by: Jaehoon Chung
    Reviewed-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    Jaehoon Chung
     
  • The intention to remove it comes from the conflict of
    what the mmc-core does with the way dw_mmc treats disable-wp.
    We could see that 'disable-wp' is supported by core but
    it's deprecated by dw_mmc as we don't expect it to be existed
    for each slot subnode but should be in the parent node. Based
    on searching for all the upstream dts using dw_mmc, we're
    confident that none of them use the deprecated way. Maybe
    we should take old dtb in consideration but it was a flag day
    since the time we was considering to take it away. The fact is
    that there are none of dts using the deprecated way since v3.18
    or even earlier. So personally I don't believe the old dtb
    would/could bootup current kernel(may not?). Let's remove it now.

    Signed-off-by: Shawn Lin
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Shawn Lin
     
  • Chipsets before Exynos5420 did not support HS400 so if MMC core tries to
    configure HS400 timing, this might or might not work. Warn in such
    cases because this is DTB misconfiguration.

    Signed-off-by: Krzysztof Kozlowski
    Reviewed-by: Alim Akhtar
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Krzysztof Kozlowski
     
  • 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: Daniel Glöckner
    Cc:
    Signed-off-by: Ulf Hansson

    Daniel Glöckner
     
  • The commit 1ef5e49e46b9 ("mmc: sdhci-of-esdhc: add/remove some quirks
    according to vendor version") moved sdhci-of-esdhc away from using the
    ->platform_init() callback.

    As it was the only user of it and that it seems reasonable to believe that
    it won't be needed again, let's just remove it.

    Signed-off-by: Ulf Hansson
    Acked-by: Adrian Hunter

    Ulf Hansson
     
  • The commit 52ac7acf412b ("mmc: sdhci-pci: Convert to use managed functions
    pcim_* and devm_*") converted ->probe() / ->remove() functions to use device
    managed resource API. Here is a follow up to cover sdhci_pci_probe_slot() and
    sdhci_pci_remove_slot().

    Signed-off-by: Andy Shevchenko
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Andy Shevchenko
     
  • When using mmc_io_rw_extended, it's intent to avoid null
    pointer of card and invalid func number. But actually it
    didn't prevent that as the seg_size already use the card.
    Currently the wrapper function sdio_io_rw_ext_helper already
    use card before calling mmc_io_rw_extended, so we should move
    this check to there. As to the func number, it was token from
    '(ocr & 0x70000000) >> 28' which should be enough to guarantee
    that it won't be larger than 7. But we should prevent the
    caller like wifi drivers modify this value. So let's move this
    check into sdio_io_rw_ext_helper either.

    Also we remove the BUG_ON for mmc_send_io_op_cond since all
    possible paths calling this function are protected by checking
    the arguments in advance. After deploying these changes, we
    could not see any panic within SDIO API even if func drivers
    abuse the SDIO func APIs.

    Signed-off-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    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: Shawn Lin
    Signed-off-by: Ulf Hansson

    Shawn Lin
     
  • The switch failure message in mmc_select_timing() had been removed
    since that is invalid: commit 0400ed0a083a ("mmc: core: remove the
    invalid message in mmc_select_timing")

    Now, in the case when mmc_select_hs() return error in mmc_select_timing(),
    there is nothing to print failure message.
    Let's make for mmc_select_hs() print message itself in the failure case.

    Signed-off-by: Jungseung Lee
    Signed-off-by: Ulf Hansson

    Jungseung Lee
     
  • Populating card_busy caused a side-effect on a chip variant we don't
    have documentation for (r8a73a4). So, enable it and voltage switching
    only on devices known to support those features.

    Signed-off-by: Wolfram Sang
    Tested-by: Geert Uytterhoeven
    Signed-off-by: Ulf Hansson
    Fixes: 452e5eef6d31 ("mmc: tmio: Add UHS-I mode support")

    Wolfram Sang
     
  • card_busy is only used/tested on SDHI for R-Car Gen2 and later.
    Move it to the SDHI driver, so we can then activate it conditionally
    depending on the SDHI type.

    Signed-off-by: Wolfram Sang
    Tested-by: Geert Uytterhoeven
    Signed-off-by: Ulf Hansson

    Wolfram Sang
     
  • The sunxi-mmc driver does not take into account the processor may be big
    endian when writing the DMA descriptors. This causes cards not to be
    detected when running a big-endian kernel. Change the descriptors for
    IDMA to use __le32 and ensure they are suitably swapped before writing.
    Tested successfully on the Cubieboard2.

    Signed-off-by: Michael Weiser
    Acked-by: Maxime Ripard
    Cc: Ulf Hansson
    Cc: Chen-Yu Tsai
    Cc: linux-mmc@vger.kernel.org
    Signed-off-by: Ulf Hansson

    Michael Weiser
     
  • clk_round_rate() may return an error. Check it.

    Signed-off-by: Jean-Francois Moine
    Acked-by: Maxime Ripard
    Signed-off-by: Ulf Hansson

    Jean-Francois Moine
     
  • PHY intended to be used with the Arasan SDHCI 5.1 controller has trouble
    turning on when the card clock is slow or off. Strangely these problems
    appear to show up consistently on some boards while other boards work
    fine, but on the boards where it shows up the problem reproduces 100% of
    the time and is quite consistent in its behavior.

    These problems can be fixed by always making sure that we power on the
    PHY (and turn on its DLL) when the card clock is faster than about 50
    MHz. Once on, we need to make sure that we never power down the PHY /
    turn off its DLL until the clock is faster again.

    We'll add logic for handling this into the sdhci-of-arasan driver. Note
    that right now the only user of a PHY in the sdhci-of-arasan driver is
    arasan,sdhci-5.1. It's presumed that all arasan,sdhci-5.1 PHY
    implementations need this workaround, so the logic is only contingent on
    having a PHY to control. If future Arasan controllers don't have this
    problem we can add code to decide if we want this flow or not.

    Also note that we check for slow clocks by checking for < 50 MHz and > 400 kHz will be running on a device where this problem
    is fixed anyway.

    I believe this brings some resolution to the problems reported before.
    See the commit 6fc09244d74d ("mmc: sdhci-of-arasan: Revert: Always power
    the PHY off/on when clock changes").

    Signed-off-by: Douglas Anderson
    Acked-by: Adrian Hunter
    Reviewed-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    Douglas Anderson
     
  • wait_event_interruptible_timeout() will return early if the blocked
    process receives a signal, causing the driver to abort the tuning
    procedure and possibly leaving the controller in a bad state. Since the
    tuning command is expected to complete quickly (
    Tested-by: Robert Foss
    Signed-off-by: Robert Foss
    Reviewed-by: Benson Leung
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Christopher Freeman
     
  • i.MX USDHC Reference Manual has a mistake, for the register SYS_CTRL,
    the DTOCV(bit 19~16) means the data timeout counter value. When DTOCV
    is set to 0xF, it means SDCLK << 29, not SDCLK << 28.

    Signed-off-by: Haibo Chen
    Acked-by: Dong Aisheng
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Haibo Chen
     
  • Now, when call esdhc_set_timeout() to set the data timeout counter value,
    IPP_RST_N(bit 23) is wrongly affected. This patch add a mask to avoid this.

    Signed-off-by: Haibo Chen
    Acked-by: Dong Aisheng
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Haibo Chen
     
  • The field "owner" is set by core. Thus delete an extra initialisation.

    Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

    Signed-off-by: Markus Elfring
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Markus Elfring
     
  • The SD Status register contains several important fields related to the
    SD Card proprietary features.
    Those fields may be used by user space applications for vendor specific
    usage.
    None of those fields are exported today by the driver to user space.
    In this patch, we are reading the SD Status register and exporting
    (using MMC_DEV_ATTR) the SD Status register to the user space.

    Signed-off-by: Uri Yanai
    Signed-off-by: Ulf Hansson

    Uri Yanai
     
  • kmalloc will print enough information in case of failure.

    Signed-off-by: Wolfram Sang
    Signed-off-by: Ulf Hansson

    Wolfram Sang
     
  • Use of_property_read_bool to check for the existence of a property.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    expression e1,e2;
    statement S2,S1;
    @@
    - if (of_get_property(e1,e2,NULL))
    + if (of_property_read_bool(e1,e2))
    S1 else S2
    //

    Signed-off-by: Julia Lawall
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Julia Lawall
     
  • The core MMC code adds two (optional) regulator properites that drivers
    should use to get their supplies. This is not documented anywhere so add
    information on it.

    Signed-off-by: Ben Dooks
    Signed-off-by: Ulf Hansson

    Ben Dooks
     
  • In clk_set_rate() or clk_prepare_enable() error handling case, the
    error return code ret is not set, so sdhci_bcm_kona_probe() return
    0 in those error cases.

    Signed-off-by: Wei Yongjun
    Acked-by: Ray Jui
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Wei Yongjun
     
  • wait_for_completion_timeout_interruptible returns long not unsigned long
    so dma_time, which is used exclusively here, is changed to long.

    Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver")
    Signed-off-by: Nicholas Mc Guire
    Signed-off-by: Ulf Hansson

    Nicholas Mc Guire
     
  • Some devices need a while to boot their firmware after providing clks /
    de-asserting resets before they are ready to receive sdio commands.

    This commits adds a post-power-on-delay-ms devicetree property to
    mmc-pwrseq-simple for use with such devices.

    Signed-off-by: Hans de Goede
    Acked-by: Rob Herring
    Signed-off-by: Ulf Hansson

    Hans de Goede
     
  • On some boards (android tablets) different batches use different sdio
    wifi modules. This is not a problem since mmc/sdio is an enumerable bus,
    so we only need to describe and activate the mmc controller in dt and
    then the kernel will automatically load the right driver.

    Sometimes it is useful to specify certain ethernet properties for these
    "unknown" sdio devices, specifically we want the boot-loader to be able
    to set "local-mac-address" as some of these sdio wifi modules come without
    an eeprom / without a factory programmed mac address.

    Since the exact device is unknown (differs per batch) we cannot use
    a wifi-chip specific compatible, thus sometimes it is desirable to have a
    mmc function node, without having to make up an otherwise unused compatible
    for the node, so make the compatible property optional.

    Cc: Arnd Bergmann
    Cc: Maxime Ripard
    Signed-off-by: Hans de Goede
    Acked-by: Rob Herring
    Signed-off-by: Ulf Hansson

    Hans de Goede
     
  • Use the new sun7i-a20-mmc compatible for the mmc controllers on sun7i
    and newer.

    Signed-off-by: Hans de Goede
    Acked-by: Maxime Ripard
    Signed-off-by: Ulf Hansson

    Hans de Goede
     
  • It turns out that sun4i (A10) and sun5i (A13 & co) do not have sample
    clocks, so add a new sun7i-a20-mmc compatible and do not try to use
    sample clocks on sun4i / sun5i.

    Since sun4i / sun5i do not have sample clocks, they cannot (reliably) do
    DDR rates, so only set MMC_CAP_1_8V_DDR when we do have sample clks.

    Note this patch leaves the clk_prepare_enable() / clk_disable_unprepare()
    calls to the sample clks as-is, without adding checks for them being
    NULL. All the clk_foo calls accept a NULL clk and will return success when
    called with a NULL clk.

    Signed-off-by: Hans de Goede
    Acked-by: Maxime Ripard
    Acked-by: Rob Herring
    Signed-off-by: Ulf Hansson

    Hans de Goede
     
  • Add a sunxi_mmc_clk_set_phase() helper function.

    Signed-off-by: Hans de Goede
    Acked-by: Maxime Ripard
    Signed-off-by: Ulf Hansson

    Hans de Goede
     
  • Create a struct to hold the various model / compatible string dependend
    settings.

    Signed-off-by: Hans de Goede
    Acked-by: Maxime Ripard
    Signed-off-by: Ulf Hansson

    Hans de Goede
     
  • When support for the sample clks was added calls to prepare_enable
    were added to the probe path, but matching calls to disable_unprepare
    were forgotten in the remove path, this fixes this.

    Signed-off-by: Hans de Goede
    Acked-by: Maxime Ripard
    Signed-off-by: Ulf Hansson

    Hans de Goede
     

26 Sep, 2016

7 commits

  • Linus Torvalds
     
  • Pull tracefs fixes from Steven Rostedt:
    "Al Viro has been looking at the tracefs code, and has pointed out some
    issues. This contains one fix by me and one by Al. I'm sure that
    he'll come up with more but for now I tested these patches and they
    don't appear to have any negative impact on tracing"

    * tag 'trace-v4.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    fix memory leaks in tracing_buffers_splice_read()
    tracing: Move mutex to protect against resetting of seq data

    Linus Torvalds
     
  • When building XFS with -Werror, it now fails with:

    include/linux/pagemap.h: In function 'fault_in_multipages_readable':
    include/linux/pagemap.h:602:16: error: variable 'c' set but not used [-Werror=unused-but-set-variable]
    volatile char c;
    ^

    This is a regression caused by commit e23d4159b109 ("fix
    fault_in_multipages_...() on architectures with no-op access_ok()").
    Fix it by re-adding the "(void)c" trick taht was previously used to make
    the compiler think the variable is used.

    Signed-off-by: Dave Chinner
    Cc: Al Viro
    Signed-off-by: Linus Torvalds

    Dave Chinner
     
  • The NUMA balancing logic uses an arch-specific PROT_NONE page table flag
    defined by pte_protnone() or pmd_protnone() to mark PTEs or huge page
    PMDs respectively as requiring balancing upon a subsequent page fault.
    User-defined PROT_NONE memory regions which also have this flag set will
    not normally invoke the NUMA balancing code as do_page_fault() will send
    a segfault to the process before handle_mm_fault() is even called.

    However if access_remote_vm() is invoked to access a PROT_NONE region of
    memory, handle_mm_fault() is called via faultin_page() and
    __get_user_pages() without any access checks being performed, meaning
    the NUMA balancing logic is incorrectly invoked on a non-NUMA memory
    region.

    A simple means of triggering this problem is to access PROT_NONE mmap'd
    memory using /proc/self/mem which reliably results in the NUMA handling
    functions being invoked when CONFIG_NUMA_BALANCING is set.

    This issue was reported in bugzilla (issue 99101) which includes some
    simple repro code.

    There are BUG_ON() checks in do_numa_page() and do_huge_pmd_numa_page()
    added at commit c0e7cad to avoid accidentally provoking strange
    behaviour by attempting to apply NUMA balancing to pages that are in
    fact PROT_NONE. The BUG_ON()'s are consistently triggered by the repro.

    This patch moves the PROT_NONE check into mm/memory.c rather than
    invoking BUG_ON() as faulting in these pages via faultin_page() is a
    valid reason for reaching the NUMA check with the PROT_NONE page table
    flag set and is therefore not always a bug.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=99101
    Reported-by: Trevor Saunders
    Signed-off-by: Lorenzo Stoakes
    Acked-by: Rik van Riel
    Cc: Andrew Morton
    Cc: Mel Gorman
    Signed-off-by: Linus Torvalds

    Lorenzo Stoakes
     
  • Pull MIPS fixes from Ralf Baechle:
    "A round of 4.8 fixes:

    MIPS generic code:
    - Add a missing ".set pop" in an early commit
    - Fix memory regions reaching top of physical
    - MAAR: Fix address alignment
    - vDSO: Fix Malta EVA mapping to vDSO page structs
    - uprobes: fix incorrect uprobe brk handling
    - uprobes: select HAVE_REGS_AND_STACK_ACCESS_API
    - Avoid a BUG warning during PR_SET_FP_MODE prctl
    - SMP: Fix possibility of deadlock when bringing CPUs online
    - R6: Remove compact branch policy Kconfig entries
    - Fix size calc when avoiding IPIs for small icache flushes
    - Fix pre-r6 emulation FPU initialisation
    - Fix delay slot emulation count in debugfs

    ATH79:
    - Fix test for error return of clk_register_fixed_factor.

    Octeon:
    - Fix kernel header to work for VDSO build.
    - Fix initialization of platform device probing.

    paravirt:
    - Fix undefined reference to smp_bootstrap"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
    MIPS: Fix delay slot emulation count in debugfs
    MIPS: SMP: Fix possibility of deadlock when bringing CPUs online
    MIPS: Fix pre-r6 emulation FPU initialisation
    MIPS: vDSO: Fix Malta EVA mapping to vDSO page structs
    MIPS: Select HAVE_REGS_AND_STACK_ACCESS_API
    MIPS: Octeon: Fix platform bus probing
    MIPS: Octeon: mangle-port: fix build failure with VDSO code
    MIPS: Avoid a BUG warning during prctl(PR_SET_FP_MODE, ...)
    MIPS: c-r4k: Fix size calc when avoiding IPIs for small icache flushes
    MIPS: Add a missing ".set pop" in an early commit
    MIPS: paravirt: Fix undefined reference to smp_bootstrap
    MIPS: Remove compact branch policy Kconfig entries
    MIPS: MAAR: Fix address alignment
    MIPS: Fix memory regions reaching top of physical
    MIPS: uprobes: fix incorrect uprobe brk handling
    MIPS: ath79: Fix test for error return of clk_register_fixed_factor().

    Linus Torvalds
     
  • Pull one more powerpc fix from Michael Ellerman:
    "powernv/pci: Fix m64 checks for SR-IOV and window alignment from
    Russell Currey"

    * tag 'powerpc-4.8-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
    powerpc/powernv/pci: Fix m64 checks for SR-IOV and window alignment

    Linus Torvalds
     
  • The fixes to the radix tree test suite show that the multi-order case is
    broken. The basic reason is that the radix tree code uses tagged
    pointers with the "internal" bit in the low bits, and calculating the
    pointer indices was supposed to mask off those bits. But gcc will
    notice that we then use the index to re-create the pointer, and will
    avoid doing the arithmetic and use the tagged pointer directly.

    This cleans the code up, using the existing is_sibling_entry() helper to
    validate the sibling pointer range (instead of open-coding it), and
    using entry_to_node() to mask off the low tag bit from the pointer. And
    once you do that, you might as well just use the now cleaned-up pointer
    directly.

    [ Side note: the multi-order code isn't actually ever used in the kernel
    right now, and the only reason I didn't just delete all that code is
    that Kirill Shutemov piped up and said:

    "Well, my ext4-with-huge-pages patchset[1] uses multi-order entries.
    It also converts shmem-with-huge-pages and hugetlb to them.

    I'm okay with converting it to other mechanism, but I need
    something. (I looked into Konstantin's RFC patchset[2]. It looks
    okay, but I don't feel myself qualified to review it as I don't
    know much about radix-tree internals.)"

    [1] http://lkml.kernel.org/r/20160915115523.29737-1-kirill.shutemov@linux.intel.com
    [2] http://lkml.kernel.org/r/147230727479.9957.1087787722571077339.stgit@zurg ]

    Reported-by: Matthew Wilcox
    Cc: Andrew Morton
    Cc: Ross Zwisler
    Cc: Johannes Weiner
    Cc: Kirill A. Shutemov
    Cc: Konstantin Khlebnikov
    Cc: Cedric Blancher
    Signed-off-by: Linus Torvalds

    Linus Torvalds