Guoniu.Zhou [Thu, 31 Aug 2017 01:39:12 +0000 (09:39 +0800)]
MMFMWK-7674: PxP: add YVU420P support
PxP PS engine support YUV420 format, but not YVU420. The difference
between two format is U and V, if we exchange U and V base address,
the PxP driver can also support YVU420 format.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit
cbc71da10afe67ae815a97a68e4a1b0dff4693eb)
Liu Ying [Tue, 29 Aug 2017 08:58:58 +0000 (16:58 +0800)]
MLK-16290 drm: Add drm_of_component_probe_with_match() helper
A component master may have both OF based and non-OF based components to be
bound with. This patch adds a helper drm_of_component_probe_with_match()
similar to drm_of_component_probe() so that the new helper may get an
additional provided match pointer(contains match entries for non-OF based
components) to support this case.
Tested-by: Meng Mingming <mingming.meng@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Liu Ying [Wed, 30 Aug 2017 03:59:03 +0000 (11:59 +0800)]
MLK-16301-2 gpu: imx: dpu: common: Remove the list in dpu plane group
No one is using the list in the dpu plane group, so let's remove it and
the mutex lock which protects the list.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Liu Ying [Wed, 30 Aug 2017 03:53:22 +0000 (11:53 +0800)]
MLK-16301-1 drm/imx: dpu: plane: Take down dpu plane from the dpu plane grp list
No one is using the list in the dpu plane group to access dpu plane, so let's
take down dpu plane from the list so that we may remove the list entirely
from where it is defined.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Han Xu [Wed, 23 Aug 2017 19:54:54 +0000 (14:54 -0500)]
MLK-16331: arm64: dts: enable flexspi on i.MX8QXP MEK
enable flexspi on i.MX8QXP MEK
Signed-off-by: Han Xu <han.xu@nxp.com>
Han Xu [Wed, 30 Aug 2017 21:05:11 +0000 (16:05 -0500)]
MLK-16330: mtd: fsl-quadspi: remove unnecessary variable
Remove the unnecessary tmp array from code
Signed-off-by: Han Xu <han.xu@nxp.com>
Han Xu [Wed, 30 Aug 2017 20:12:53 +0000 (15:12 -0500)]
MLK-16329-2: mtd: fsl-flexspi: fix the start address alignment issue
FLEXSPI AHBCR register has one bit READADDROPT, which defined if start
address must be aligned when doing wordaddress access. This bit must be
set (no alignment limitation), otherwise controller may always try
to access from even address and got wrong data when AHB read data under
Octal DDR mode. Mounting UBIFS failed in this case since it read from
odd address.
[ 250.367893] fsl_fspi_read: from 620ad1, len: 11
[ 250.374700] UBIFS error (ubi0:0 pid 2871): check_lpt_type: invalid
type (4) in LPT node type 2
[ 250.383326] CPU: 0 PID: 2871 Comm: mount Not tainted
4.9.11-03067-gd6ce90a-dirty #251
[ 250.391156] Hardware name: Freescale i.MX8QM ARM2 (DT)
[ 250.396291] Call trace:
[ 250.398739] [<
ffff0000080882bc>] dump_backtrace+0x0/0x1e0
[ 250.404139] [<
ffff0000080884b0>] show_stack+0x14/0x1c
[ 250.409198] [<
ffff0000083b3798>] dump_stack+0x8c/0xac
[ 250.414251] [<
ffff00000833c434>] check_lpt_type+0x80/0x88
[ 250.419654] [<
ffff00000833eb74>] ubifs_lpt_init+0x448/0x8a4
[ 250.425222] [<
ffff000008325a38>] ubifs_mount+0xde0/0x198c
[ 250.430620] [<
ffff0000081db2e0>] mount_fs+0x3c/0x15c
[ 250.435589] [<
ffff0000081f7070>] vfs_kern_mount+0x4c/0x11c
[ 250.441077] [<
ffff0000081fa26c>] do_mount+0x1b8/0xb5c
[ 250.446125] [<
ffff0000081faf3c>] SyS_mount+0x78/0xd8
[ 250.451085] [<
ffff000008082f4c>] __sys_trace_return+0x0/0x4
[ 250.456787] ---lpt_init_rd
[ 250.459530] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" stops
Signed-off-by: Han Xu <han.xu@nxp.com>
Han Xu [Wed, 30 Aug 2017 20:12:35 +0000 (15:12 -0500)]
MLK-16329-1: mtd: fsl-flexspi: fix the unalignment issue for fspi
ARM64 platforms may access FSPI from non-64-bit-aligned address which
causes unalignment fault. Fixed the issue for AHB reading.
Signed-off-by: Han Xu <han.xu@nxp.com>
Ranjani Vaidyanathan [Thu, 24 Aug 2017 22:53:44 +0000 (17:53 -0500)]
MLK-16264 soc:imx8qm/imx8qxp: Update to the latest SCFW API
Update uboot to the latest SCFW based on commit:
"
commit
129c16e312334af7b07d71d6dccac1cda1808b93
Author: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
Date: Thu Aug 24 16:50:59 2017 -0500
Add support to change DRC clock rate.
"
Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
Adriana Reus [Mon, 28 Aug 2017 10:57:22 +0000 (13:57 +0300)]
MLK-16281-2: clk-imx8qm: Fix GPT clock hierarchy
There are five gpt modules on imx8qm (gpt0 .. gpt4).
Of these, gpt2 and gpt4 clock hierarchies are inconsistent with the
rest.
Having the per clocks (gpt_hf_clk and gpt_clk) as children of the
peripheral access clock (ipg_s) and bus sync slave clock (ipg_slv_clk)
ensures that the latter are enabled when the driver enables the gpt_clk
(or hf).
This patch reconciles these two gpt clock trees with the rest.
Before:
gpt_2_div
gpt_2_hf_clk
gpt_2_ipg_s_clk
gpt_2_ipg_slv_clk
gpt_2_clk
gpt_4_div
gpt_4_hf_clk
gpt_4_clk
gpt_4_ipg_s_clk
gpt_4_ipg_slv_clk
After:
gpt_2_div
gpt_2_ipg_s_clk
gpt_2_ipg_slv_clk
gpt_2_hf_clk
gpt_2_clk
gpt_4_div
gpt_4_ipg_s_clk
gpt_4_ipg_slv_clk
gpt_4_hf_clk
gpt_4_clk
Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Adriana Reus [Mon, 28 Aug 2017 10:48:00 +0000 (13:48 +0300)]
MLK-16281-1: clk-imx8qm: Remove duplicated gpt clocks
Some gpt clocks are defined twice which results in:
gpt0_div
gpt0_clk
and also:
gpt_0_div
gpt_0_ipg_s_clk
gpt_0_ipg_slv_clk
gpt_0_hf_clk
gpt_0_clk
The second version is correct as per gpt lpcg cell.
This patch removes the first set of clocks.
Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
Guoniu.Zhou [Fri, 25 Aug 2017 10:57:08 +0000 (18:57 +0800)]
MLK-16276: PxP: Improve code compatibility
g2d code has different parameter setting about stride parameter.
For compatibility with all cases of using PxP, we need add this
improved feature.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit
53c8ffffec181a765f4487a9d1bf2eb05b1b78f7)
Guoniu.Zhou [Fri, 25 Aug 2017 10:48:32 +0000 (18:48 +0800)]
MLK-16252: PxP: fix video shift issue
If pxp use crop x/y valuse as the upper left coordinate in
out buffer, pxp driver only need to write out buffer base
address to pxp out_buf register. If pxp driver use zero as
ps_ulc register value, pxp out_buf register need an offset
added with out buffer base address.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit
14c988f1eb7e9471b0875016df29708865727fbb)
Viorel Suman [Wed, 30 Aug 2017 08:55:13 +0000 (11:55 +0300)]
MLK-16275: ARM64: dts: imx8qxp-mek: Enable AMIX
Enable AMIX support and fix the clock tree rates for
IMX8QXP_AUD_MCLKOUT0.
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Anson Huang [Wed, 30 Aug 2017 02:42:07 +0000 (10:42 +0800)]
MLK-16300 thermal: imx: avoid error message of get_temp when thermal zone is off
For i.MX system controller thermal, when some of the thermal
zones are powered off, the get temp will fail, and thermal driver
will return CPU thermal zone's temp instead. But current driver
will return A53 cluster for all cases, and A53 cluster may be
also off when booting up A72 cluster only, so below error message
will come out:
[ 475.606431] read temp sensor:0 failed
[ 475.610107] thermal thermal_zone0: failed to read out thermal zone (-22)
To avoid this error, for the case of thermal zones power off,
thermal driver can return current thread's CPU cluster temperature.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
Anson Huang [Tue, 29 Aug 2017 06:08:05 +0000 (14:08 +0800)]
MLK-16286-2 defconfig: enable cpu-freq schedutil governor
Enable cpu-freq schedutil governor by default.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
Anson Huang [Tue, 29 Aug 2017 06:06:31 +0000 (14:06 +0800)]
MLK-16286-1 arm64: dts: freescale: imx8qm: add cpu opp table
Add i.MX8QM CPU OPP table to support cpu-freq.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Bai Ping <ping.bai@nxp.com>
Meng Mingming [Tue, 29 Aug 2017 10:02:12 +0000 (18:02 +0800)]
MLK-16291-4: Revert "MLK-15321 dpu-blit: Add dpu blit engine driver"
This reverts commit
60fd1ffd2873 ("MLK-15321 dpu-blit: Add dpu blit
engine driver").
Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
Meng Mingming [Tue, 29 Aug 2017 09:56:22 +0000 (17:56 +0800)]
MLK-16291-3: Revert "MLK-15321 dpu: Register the blit engine(s)."
This reverts commit
9b9d4d8ab1ec ("MLK-15321 dpu: Register the blit
engine(s).").
It's no need to add dpu_add_feature_devices(), and it's
better to identify bliteng as a device but a feature.
Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
Meng Mingming [Tue, 29 Aug 2017 09:47:07 +0000 (17:47 +0800)]
MLK-16291-2: Revert "MLK-15321 drm,imx: Add DRM support for dpu-blit"
This reverts commit
b4c70b278a5e ("MLK-15321 drm,imx: Add DRM support
for dpu-blit").
It's no need to invent register/unregister solution to
add dpu bliteng ioctl. It's complex and overengineering.
And currently we will choose a simple way as
drm->driver->ioctls = imx_drm_dpu_ioctls.
Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
Meng Mingming [Tue, 29 Aug 2017 09:41:26 +0000 (17:41 +0800)]
MLK-16291-1: Revert "MGS-3800 drm,imx: drop drm_of_component_probe() in favor of imx specifics."
This reverts commit
97ca244f0470 ("MGS-3800 drm,imx:
drop drm_of_component_probe() in favor of imx specifics.").
It need remove add_display_components() and add a new method
as drm_of_component_probe_with_match().
Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
Haibo Chen [Fri, 25 Aug 2017 09:52:03 +0000 (17:52 +0800)]
MLK-16274 ARM64: dts: correct the pad setting of USDHC
i.MX8QM/i.MX8QX USDHC pads are dual voltage pads, and the
defiintation of each bit are different. Only bit[0] define
the drive strength slection, bit[4:1] are reserved.
0 means high drive strength
1 means low drive strength
This patch correct these pad setting, setting the usdhc
100mhz/200mhz pin at high drive strength.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Haibo Chen [Fri, 4 Aug 2017 09:01:17 +0000 (17:01 +0800)]
MLK-16155-13 mmc: sdhci-esdhc-imx: add DCMD support for CMDQ
Currently, USDHC do not generate transfer complete interrupt
when send a non-data-command with R1b response. But if want
to support DCMD in CMDQ, need to change this, the DCMD IC
logic require the USDHC to enable this function, otherwise
DCMD will never get a CC(command complete) interrupt.
This patch set ESDHC_VEND_SPEC2_EN_BUSY_IRQ and add DCMD support.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Haibo Chen [Fri, 4 Aug 2017 07:29:44 +0000 (15:29 +0800)]
MLK-16155-12 mmc: sdhci-esdhc-imx: add CMDQ support
Add CMDQ support for imx8qm/imx8qxp.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Haibo Chen [Fri, 4 Aug 2017 03:21:03 +0000 (11:21 +0800)]
MLK-16155-11 mmc: sdhci: correct the maximum timeout when enable CMDQ
Priority use the callback set_timeout() to set the maximum timeout
if the host has.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Venkat Gopalakrishnan [Thu, 15 Jun 2017 11:06:38 +0000 (14:06 +0300)]
MLK-16155-10 mmc: cqhci: support for command queue enabled host
This patch adds CMDQ support for command-queue compatible
hosts.
Command queue is added in eMMC-5.1 specification. This
enables the controller to process upto 32 requests at
a time.
Adrian Hunter contributed renaming to cqhci, recovery, suspend
and resume, cqhci_off, cqhci_wait_for_idle, and external timeout
handling.
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Adrian Hunter [Thu, 15 Jun 2017 11:06:37 +0000 (14:06 +0300)]
MLK-16155-9 mmc: block: Add CQE support
Add CQE support to the block driver, including:
- optionally using DCMD for flush requests
- manually issuing discard requests
- issuing read / write requests to the CQE
- supporting block-layer timeouts
- handling recovery
- supporting re-tuning
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Adrian Hunter [Thu, 15 Jun 2017 11:06:36 +0000 (14:06 +0300)]
MLK-16155-8 mmc: block: Prepare CQE data
Enhance mmc_blk_data_prep() to support CQE requests.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Adrian Hunter [Thu, 15 Jun 2017 11:06:35 +0000 (14:06 +0300)]
MLK-16155-7 mmc: mmc: Enable CQE's
Enable or disable CQE when a card is added or removed respectively.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Adrian Hunter [Thu, 15 Jun 2017 11:06:34 +0000 (14:06 +0300)]
MLK-16155-6 mmc: mmc: Enable Command Queuing
Enable the Command Queue if the host controller supports i a command queue
engine. It is not compatible with Packed Commands, so do not enable that
at the same time.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Adrian Hunter [Thu, 15 Jun 2017 11:06:33 +0000 (14:06 +0300)]
MLK-16155-5 mmc: core: Add support for handling CQE requests
Add core support for handling CQE requests, including starting, completing
and recovering.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Adrian Hunter [Thu, 15 Jun 2017 11:06:32 +0000 (14:06 +0300)]
MLK-16155-4 mmc: core: Turn off CQE before sending commands
Turn off the CQE before sending commands, and ensure it is off in any reset
or power management paths, or re-tuning.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Adrian Hunter [Thu, 15 Jun 2017 11:06:31 +0000 (14:06 +0300)]
MLK-16155-3 mmc: host: Add CQE interface
Add CQE host operations, capabilities, and host members.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Adrian Hunter [Thu, 15 Jun 2017 11:06:30 +0000 (14:06 +0300)]
MLK-16155-2 mmc: core: Add members to mmc_request and mmc_data for CQE's
Most of the information needed to issue requests to a CQE is already in
struct mmc_request and struct mmc_data. Add data block address, some flags,
and the task id (tag), and allow for cmd being NULL which it is for CQE
tasks.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Adrian Hunter [Thu, 15 Jun 2017 11:06:29 +0000 (14:06 +0300)]
MLK-16155-1 mmc: core: Add mmc_retune_hold_now()
In preparation for CQE support.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Linus Walleij [Thu, 18 May 2017 09:29:33 +0000 (11:29 +0200)]
mmc: block: Tag is_rpmb as bool
The variable is_rpmb is clearly a bool and even assigned true
and false, yet declared as an int.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
829043c48e5d7169d45a04027a787b55133f4cf6)
Linus Walleij [Thu, 18 May 2017 09:29:32 +0000 (11:29 +0200)]
mmc: core: Allocate per-request data using the block layer core
The mmc_queue_req is a per-request state container the MMC core uses
to carry bounce buffers, pointers to asynchronous requests and so on.
Currently allocated as a static array of objects, then as a request
comes in, a mmc_queue_req is assigned to it, and used during the
lifetime of the request.
This is backwards compared to how other block layer drivers work:
they usally let the block core provide a per-request struct that get
allocated right beind the struct request, and which can be obtained
using the blk_mq_rq_to_pdu() helper. (The _mq_ infix in this function
name is misleading: it is used by both the old and the MQ block
layer.)
The per-request struct gets allocated to the size stored in the queue
variable .cmd_size initialized using the .init_rq_fn() and
cleaned up using .exit_rq_fn().
The block layer code makes the MMC core rely on this mechanism to
allocate the per-request mmc_queue_req state container.
Doing this make a lot of complicated queue handling go away. We only
need to keep the .qnct that keeps count of how many request are
currently being processed by the MMC layer. The MQ block layer will
replace also this once we transition to it.
Doing this refactoring is necessary to move the ioctl() operations
into custom block layer requests tagged with REQ_OP_DRV_[IN|OUT]
instead of the custom code using the BigMMCHostLock that we have
today: those require that per-request data be obtainable easily from
a request after creating a custom request with e.g.:
struct request *rq = blk_get_request(q, REQ_OP_DRV_IN, __GFP_RECLAIM);
struct mmc_queue_req *mq_rq = req_to_mq_rq(rq);
And this is not possible with the current construction, as the request
is not immediately assigned the per-request state container, but
instead it gets assigned when the request finally enters the MMC
queue, which is way too late for custom requests.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[Ulf: Folded in the fix to drop a call to blk_cleanup_queue()]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Heiner Kallweit <hkallweit1@gmail.com>
(cherry picked from commit
304419d8a7e9204c5d19b704467b814df8c8f5b1)
Linus Walleij [Thu, 18 May 2017 09:29:31 +0000 (11:29 +0200)]
mmc: core: Delete bounce buffer Kconfig option
This option is activated by all multiplatform configs and what
not so we almost always have it turned on, and the memory it
saves is negligible, even more so moving forward. The actual
bounce buffer only gets allocated only when used, the only
thing the ifdefs are saving is a little bit of code.
It is highly improper to have this as a Kconfig option that
get turned on by Kconfig, make this a pure runtime-thing and
let the host decide whether we use bounce buffers. We add a
new property "disable_bounce" to the host struct.
Notice that mmc_queue_calc_bouncesz() already disables the
bounce buffers if host->max_segs != 1, so any arch that has a
maximum number of segments higher than 1 will have bounce
buffers disabled.
The option CONFIG_MMC_BLOCK_BOUNCE is default y so the
majority of platforms in the kernel already have it on, and
it then gets turned off at runtime since most of these have
a host->max_segs > 1. The few exceptions that have
host->max_segs == 1 and still turn off the bounce buffering
are those that disable it in their defconfig.
Those are the following:
arch/arm/configs/colibri_pxa300_defconfig
arch/arm/configs/zeus_defconfig
- Uses MMC_PXA, drivers/mmc/host/pxamci.c
- Sets host->max_segs = NR_SG, which is 1
- This needs its bounce buffer deactivated so we set
host->disable_bounce to true in the host driver
arch/arm/configs/davinci_all_defconfig
- Uses MMC_DAVINCI, drivers/mmc/host/davinci_mmc.c
- This driver sets host->max_segs to MAX_NR_SG, which is 16
- That means this driver anyways disabled bounce buffers
- No special action needed for this platform
arch/arm/configs/lpc32xx_defconfig
arch/arm/configs/nhk8815_defconfig
arch/arm/configs/u300_defconfig
- Uses MMC_ARMMMCI, drivers/mmc/host/mmci.[c|h]
- This driver by default sets host->max_segs to NR_SG,
which is 128, unless a DMA engine is used, and in that case
the number of segments are also > 1
- That means this driver already disables bounce buffers
- No special action needed for these platforms
arch/arm/configs/sama5_defconfig
- Uses MMC_SDHCI, MMC_SDHCI_PLTFM, MMC_SDHCI_OF_AT91, MMC_ATMELMCI
- Uses drivers/mmc/host/sdhci.c
- Normally sets host->max_segs to SDHCI_MAX_SEGS which is 128 and
thus disables bounce buffers
- Sets host->max_segs to 1 if SDHCI_USE_SDMA is set
- SDHCI_USE_SDMA is only set by SDHCI on PCI adapers
- That means that for this platform bounce buffers are already
disabled at runtime
- No special action needed for this platform
arch/blackfin/configs/CM-BF533_defconfig
arch/blackfin/configs/CM-BF537E_defconfig
- Uses MMC_SPI (a simple MMC card connected on SPI pins)
- Uses drivers/mmc/host/mmc_spi.c
- Sets host->max_segs to MMC_SPI_BLOCKSATONCE which is 128
- That means this platform already disables bounce buffers at
runtime
- No special action needed for these platforms
arch/mips/configs/cavium_octeon_defconfig
- Uses MMC_CAVIUM_OCTEON, drivers/mmc/host/cavium.c
- Sets host->max_segs to 16 or 1
- Setting host->disable_bounce to be sure for the 1 case
arch/mips/configs/qi_lb60_defconfig
- Uses MMC_JZ4740, drivers/mmc/host/jz4740_mmc.c
- This sets host->max_segs to 128 so bounce buffers are
already runtime disabled
- No action needed for this platform
It would be interesting to come up with a list of the platforms
that actually end up using bounce buffers. I have not been
able to infer such a list, but it occurs when
host->max_segs == 1 and the bounce buffering is not explicitly
disabled.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
c3dccb74be28a345a2ebcc224e41b774529b8b8f)
Conflicts:
drivers/mmc/host/cavium.c
Christoph Hellwig [Fri, 27 Jan 2017 16:51:45 +0000 (09:51 -0700)]
block: allow specifying size for extra command data
This mirrors the blk-mq capabilities to allocate extra drivers-specific
data behind struct request by setting a cmd_size field, as well as having
a constructor / destructor for it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit
6d247d7f71d1fa4b66a5f4da7b1daa21510d529b)
Christoph Hellwig [Tue, 3 Jan 2017 11:52:44 +0000 (14:52 +0300)]
block: simplify blk_init_allocated_queue
Return an errno value instead of the passed in queue so that the callers
don't have to keep track of two queues, and move the assignment of the
request_fn and lock to the caller as passing them as argument doesn't
simplify anything. While we're at it also remove two pointless NULL
assignments, given that the request structure is zeroed on allocation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit
5ea708d15a928f7a479987704203616d3274c03b)
Conflicts:
block/blk-core.c
Ulf Hansson [Thu, 13 Apr 2017 14:48:11 +0000 (16:48 +0200)]
mmc: sdio: Add API to manage SDIO IRQs from a workqueue
For hosts not supporting MMC_CAP2_SDIO_IRQ_NOTHREAD but MMC_CAP_SDIO_IRQ,
the SDIO IRQs are processed from a dedicated kernel thread. For these
cases, the host calls mmc_signal_sdio_irq() from its ISR to signal a new
SDIO IRQ.
Signaling an SDIO IRQ makes the host's ->enable_sdio_irq() callback to be
invoked to temporary disable the IRQs, before the kernel thread is woken up
to process it. When processing of the IRQs are completed, they are
re-enabled by the kernel thread, again via invoking the host's
->enable_sdio_irq().
The observation from this, is that the execution path is being unnecessary
complex, as the host driver already knows that it needs to temporary
disable the IRQs before signaling a new one. Moreover, replacing the kernel
thread with a work/workqueue would not only greatly simplify the code, but
also make it more robust.
To address the above problems, let's continue to build upon the support for
MMC_CAP2_SDIO_IRQ_NOTHREAD, as it already implements SDIO IRQs to be
processed without using the clumsy kernel thread and without the ping-pong
calls of the host's ->enable_sdio_irq() callback for each processed IRQ.
Therefore, let's add new API sdio_signal_irq(), which enables hosts to
signal/process SDIO IRQs by using a work/workqueue, rather than using the
kernel thread.
Add also a new host callback ->ack_sdio_irq(), which the work invokes when
the SDIO IRQs have been processed. This informs the host about when it
shall re-enable the SDIO IRQs. Potentially, we could re-use the existing
->enable_sdio_irq() callback instead of adding a new one, however it has
turned out that it's more convenient for hosts to get this information via
a separate callback.
Hosts that wants to use this new method to signal/process SDIO IRQs, must
enable MMC_CAP2_SDIO_IRQ_NOTHREAD and implement the ->ack_sdio_irq()
callback.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit
682696605c7093d2800c498c04166831e5aedf87)
Ulf Hansson [Wed, 19 Apr 2017 19:52:29 +0000 (21:52 +0200)]
mmc: core: Prevent processing SDIO IRQs when none is claimed
In cases when MMC_CAP2_SDIO_IRQ_NOTHREAD is set, there is a minor window
for when the mmc host could call sdio_run_irqs(), while in fact an SDIO
func driver could have decided to released the SDIO IRQ via a call to
sdio_release_irq(). In this scenario, processing of the SDIO IRQs are done
even if there is none IRQ claimed, which is not what we want.
To prevent this from happen, close the window by validating that at least
one SDIO IRQs is claimed, before deciding to process them.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit
e3a84267ab3184656929b4cbf03fca4d446125dd)
Ulf Hansson [Mon, 8 May 2017 21:52:04 +0000 (23:52 +0200)]
mmc: core: Don't do eMMC HW reset when resuming the eMMC card
In case if a pwrseq-emmc has been bound to the host, a call to
mmc_power_up() triggers an eMMC HW reset via the pwrseq_emmc's
->post_power_on() callback. This isn't really what we want, as
mmc_power_up() is called each time when resuming the card.
As a matter of fact, the current approach may also violate the eMMC spec,
as the involved delays managed in pwrseq_emmc assumes both VCC and VCCQ has
been turned on, which isn't the case for VCCQ, unless the regulator is
always on.
Fix this behaviour by aligning to the same procedure used when the mmc host
implements the ->hw_reset() callback and has the MMC_CAP_HW_RESET flag set.
In this way the eMMC HW reset is issued at card detection scan, to cope
with bogus bootloaders and in the error recovery path via the mmc specific
bus_ops->reset() callback.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
(cherry picked from commit
52c8212d80b69d2197bb8506384b6e6a0aef7fb7)
Ulf Hansson [Mon, 8 May 2017 21:49:12 +0000 (23:49 +0200)]
mmc: pwrseq: Add reset callback to the struct mmc_pwrseq_ops
The ->reset() callback is needed to implement a better support for eMMC HW
reset. The following changes will take advantage of the new callback.
Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
(cherry picked from commit
773a9ef85f02f6a82f58244f33cb628ad1ecac21)
Ulf Hansson [Sat, 6 May 2017 09:43:05 +0000 (11:43 +0200)]
mmc: pwrseq_simple: Parse DTS for the power-off-delay-us property
If the optional power-off-delay-us property is found, insert the
corresponding delay after asserting the GPIO during power off. This enables
a graceful shutdown sequence for some devices.
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
(cherry picked from commit
e9256e142f597edf90c68cec22db4c4aebaa27de)
Ulf Hansson [Sat, 6 May 2017 09:41:30 +0000 (11:41 +0200)]
mmc: dt: pwrseq-simple: Invent power-off-delay-us
During power off, after the GPIO pin has been asserted, some devices like
the Wifi chip from TI, Wl18xx, needs a delay before the host continues with
clock gating and turning off regulators as to follow a graceful shutdown
sequence.
Therefore invent an optional power-off-delay-us DT binding for
mmc-pwrseq-simple, to allow us to support this constraint.
Cc: devicetree@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
(cherry picked from commit
c477ebe21fabe0010a2ed324ce3a1762c757d867)
Ulf Hansson [Mon, 24 Apr 2017 18:41:55 +0000 (13:41 -0500)]
mmc: core: Export API to allow hosts to get the card address
Some hosts controllers, like Cavium, needs to know whether the card
operates in byte- or block-address mode. Therefore export a new API,
mmc_card_is_blockaddr(), which provides this information.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Steven J. Hill <Steven.Hill@cavium.com>
Acked-by: David Daney <david.daney@cavium.com>
(cherry picked from commit
33e6d74d65c358270f00d228877178964aab84b3)
jiajie.hao@mediatek.com [Sun, 23 Apr 2017 09:38:27 +0000 (17:38 +0800)]
mmc: sdio: Fix sdio wait busy implement limitation
The host may issue an I/O abort by writing to the CCCR at any time
during I/O read operation via CMD52. And host may need suspend
transcation during write busy stage in SDIO suspend/resume scenario.
>From other side, a card may accept CMD52 during data transfer phase.
Previous implement would block issuing above command in busy stage.
It cause function driver can't implement as proper way and has no
opportunity to do some coverage in error case via I/O abort etc.
We need bypass some necessary operation during busy check stage.
Signed-off-by: Jiajie Hao <jiajie.hao@mediatek.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
f328c76e568d13c9fee21b5cf7411c96285f0f89)
Winkler, Tomas [Sun, 2 Apr 2017 20:56:03 +0000 (23:56 +0300)]
mmc: core: add proper be32 annotation
Annotate big endian values correctly and make sparse happy.
In mmc_app_send_scr remove scr function parameter as it was
updating card->raw_scr anyway.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
06c9ccb78e68e2e9b69e736fc0a39fb13be49b74)
Hu Ziji [Thu, 30 Mar 2017 15:22:57 +0000 (17:22 +0200)]
mmc: sdhci: Export sdhci_enable_sdio_irq() from sdhci.c
Export sdhci_enable_sdio_irq() from sdhci.c.
Thus vendor SDHC driver can implement its specific SDIO irq
control.
Signed-off-by: Hu Ziji <huziji@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
2f05b6ab5fa7f279015c70f625ec5c532781eb2b)
Hu Ziji [Thu, 30 Mar 2017 15:22:56 +0000 (17:22 +0200)]
mmc: sdhci: Export sdhci_start_signal_voltage_switch() in sdhci.c
Export sdhci_start_signal_voltage_switch() from sdhci.c.
Thus vendor sdhci driver can implement its own signal voltage
switch routine.
Signed-off-by: Hu Ziji <huziji@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
c376ea9e46215fbfa09b371f79c821fa5a51f26e)
Hu Ziji [Thu, 30 Mar 2017 15:22:55 +0000 (17:22 +0200)]
mmc: sdhci: Export sdhci_set_ios() from sdhci.c
Export sdhci_set_ios() in sdhci.c.
Thus vendor sdhci driver can implement its own set_ios() routine.
Signed-off-by: Hu Ziji <huziji@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
6a6d4ceb7be0c72b2190f4b6b9d5d8982957fc04)
Linus Walleij [Tue, 28 Mar 2017 08:40:31 +0000 (10:40 +0200)]
mmc: core: refactor mmc_request_done()
We have this construction:
if (a && b && !c)
finalize;
else
block;
finalize;
Which is equivalent by boolean logic to:
if (!a || !b || c)
block;
finalize;
Which is simpler code.
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
67b8360acc0d717c46af3008fc10dcc5c91f7745)
Linus Walleij [Tue, 28 Mar 2017 08:40:30 +0000 (10:40 +0200)]
mmc: core: refactor asynchronous request finalization
mmc_wait_for_data_req_done() is called in exactly one place,
and having it spread out is making things hard to oversee.
Factor this function into mmc_finalize_areq().
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
0e72f95bf329dea7985f0f4ac81cc888e8b79797)
Linus Walleij [Tue, 28 Mar 2017 08:40:29 +0000 (10:40 +0200)]
mmc: core: move some code in mmc_start_areq()
"previous" is a better name for the variable storing the previous
asynchronous request, better than the opaque name "data" atleast.
We see that we assign the return status to the returned variable
on all code paths, so we might as well just do that immediately
after calling mmc_finalize_areq().
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
5744d50d2d9e7efdae4b5d13cd71f49256ada6ba)
Adrian Hunter [Mon, 13 Mar 2017 12:36:43 +0000 (14:36 +0200)]
mmc: core: Factor out mrq preparation from mmc_start_request()
In preparation to reuse the code for CQE support.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
f34bdd2f7e2881090f566a2f93b0d8e1189091e0)
Adrian Hunter [Mon, 13 Mar 2017 12:36:42 +0000 (14:36 +0200)]
mmc: core: Factor out debug prints from mmc_start_request()
In preparation to reuse the code for CQE support.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
4b67e63faaa21eab225bc3827a9d06e6ae54bdc7)
Adrian Hunter [Mon, 13 Mar 2017 12:36:41 +0000 (14:36 +0200)]
mmc: block: Factor out data preparation
Factor out data preparation into a separate function mmc_blk_data_prep()
which can be re-used for command queuing.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
ca5717f7ceef3c0aa76e2f77acb95ec3a93470c8)
Adrian Hunter [Mon, 13 Mar 2017 12:36:40 +0000 (14:36 +0200)]
mmc: block: Change mmc_apply_rel_rw() to get block address from the request
mmc_apply_rel_rw() will be used by Software Command Queuing also. In that
case the command argument is not the block address so change
mmc_apply_rel_rw() to get block address from the request.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
9cb38f7a2d0aab5730ac18117ab2f5c9e3d4a826)
Adrian Hunter [Mon, 13 Mar 2017 12:36:39 +0000 (14:36 +0200)]
mmc: block: Disable Command Queue while RPMB is used
RPMB does not allow Command Queue commands. Disable and re-enable the
Command Queue when switching.
Note that the driver only switches partitions when the queue is empty.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Harjani Ritesh <riteshh@codeaurora.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
025e3d5fe157e8a12ed4ab59d0e147046c87cbd9)
Adrian Hunter [Mon, 13 Mar 2017 12:36:38 +0000 (14:36 +0200)]
mmc: mmc_test: Disable Command Queue while mmc_test is used
Normal read and write commands may not be used while the command queue is
enabled. Disable the Command Queue when mmc_test is probed and re-enable it
when it is removed.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Harjani Ritesh <riteshh@codeaurora.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
9d4579a85c84340044b10ffa6cd576397f59dc93)
Adrian Hunter [Mon, 13 Mar 2017 12:36:37 +0000 (14:36 +0200)]
mmc: mmc: Add functions to enable / disable the Command Queue
Add helper functions to enable or disable the Command Queue.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
b658af718465cd1e8011c8da281befdfc2debefd)
Adrian Hunter [Mon, 13 Mar 2017 12:36:36 +0000 (14:36 +0200)]
mmc: queue: Share mmc request array between partitions
eMMC can have multiple internal partitions that are represented as separate
disks / queues. However switching between partitions is only done when the
queue is empty. Consequently the array of mmc requests that are queued can
be shared between partitions saving memory.
Keep a pointer to the mmc request queue on the card, and use that instead
of allocating a new one for each partition.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
7b410d074b253a44624497a18e73f666a9574f37)
Adrian Hunter [Mon, 13 Mar 2017 12:36:35 +0000 (14:36 +0200)]
mmc: block: Introduce queue semantics
Change from viewing the requests in progress as 'current' and 'previous',
to viewing them as a queue. The current request is allocated to the first
free slot. The presence of incomplete requests is determined from the
count (mq->qcnt) of entries in the queue. Non-read-write requests (i.e.
discards and flushes) are not added to the queue at all and require no
special handling. Also no special handling is needed for the
MMC_BLK_NEW_REQUEST case.
As well as allowing an arbitrarily sized queue, the queue thread function
is significantly simpler.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
cdf8a6fb48882651049e468e6b16956fb83db86c)
Adrian Hunter [Mon, 13 Mar 2017 12:36:34 +0000 (14:36 +0200)]
mmc: block: Use local var for mqrq_cur
A subsequent patch will remove 'mq->mqrq_cur'. Prepare for that by
assigning it to a local variable.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
8ddfe07e18c9c82f7567d3cfbd68d8b59764d015)
Heiner Kallweit [Sun, 26 Mar 2017 18:45:56 +0000 (20:45 +0200)]
mmc: use new core function mmc_get_dma_dir
Use new core function mmc_get_dma_dir().
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
feeef096a770d288c943c1759785bd9d4f9247b7)
Conflicts:
drivers/mmc/host/dw_mmc.c
Heiner Kallweit [Sun, 26 Mar 2017 18:41:32 +0000 (20:41 +0200)]
mmc: core: add mmc_get_dma_dir
Add function for determining DMA direction to core.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
6335d68349a85382cc55a5260d5bfda85f8e24a8)
Shawn Lin [Fri, 24 Mar 2017 07:50:12 +0000 (15:50 +0800)]
mmc: sdhci: clarify the get_timeout_clock callback
Currently the get_timeout_clock callback doesn't clearly
have a statement that it needs the variant drivers to return
the timeout clock rate in kHz if the SDHCI_TIMEOUT_CLK_UNIT
isn't present, otherwise the variant drivers should return it
in MHz. It's also very likely that further variant drivers which
are going to use this callback will be confused by this situation.
Given the fact that moderm sdhci variant hosts are very prone to get
the timeout clock from common clock framework (actually the only three
users did that), it's more natural to return the value in Hz and we
make an explicit comment there. Then we put the unit conversion inside
the sdhci core. Thus will improve the code and prevent further misuses.
Reported-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
8cc35289227c5cbb8811048519c1703e2137d421)
Conflicts:
drivers/mmc/host/sdhci-cadence.c
drivers/mmc/host/sdhci-of-arasan.c
Heiner Kallweit [Wed, 22 Mar 2017 20:59:29 +0000 (21:59 +0100)]
mmc: sdio: improve mmc_io_rw_extended
Improve mmc_io_rw_extended a little:
- using DIV_ROUND_UP achieves the same but is better readable
- simplify code by using sg_set_buf
- simplify one statement by using -= operator
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
7aceaf566e1d6f7bf29516d680ee883697909cc7)
Adrian Hunter [Mon, 20 Mar 2017 17:50:47 +0000 (19:50 +0200)]
mmc: sdhci: Add CQE support
Add an interrupt hook and helper functions for enabling, disabling and
delivering interrupts to a CQE.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
f12e39dbf3e6eb521435085712addc131d803bfd)
Adrian Hunter [Mon, 20 Mar 2017 17:50:46 +0000 (19:50 +0200)]
mmc: sdhci: Factor out sdhci_set_default_irqs
Factor out sdhci_set_default_irqs().
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
f5c1ab821b96419261e7676efb1a355e9d735faf)
Adrian Hunter [Mon, 20 Mar 2017 17:50:45 +0000 (19:50 +0200)]
mmc: sdhci: Add sdhci_cleanup_host
Add sdhci_cleanup_host() to cleanup __sdhci_add_host().
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
4180ffa81779551a25772efae1128ac5a9689536)
Adrian Hunter [Mon, 20 Mar 2017 17:50:44 +0000 (19:50 +0200)]
mmc: sdhci: Get rid of 'extern' in header file
Get rid of unnecessary 'extern' in header file.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
15becf68b86741be282880196f1e5155b1a9a033)
Adrian Hunter [Mon, 20 Mar 2017 17:50:43 +0000 (19:50 +0200)]
mmc: sdhci: Export sdhci_dumpregs
Export sdhci_dumpregs so that it can be called by drivers.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
d28981727dccd0e1e867deceaa709bc89f1a5ebc)
Adrian Hunter [Mon, 20 Mar 2017 17:50:42 +0000 (19:50 +0200)]
mmc: sdhci: Improve register dump print format
Ensure all prints start with the mmc host name, and the text all lines up.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
85ad90e2f819a5c7f5d1005da32660eff7680abf)
Adrian Hunter [Mon, 20 Mar 2017 17:50:41 +0000 (19:50 +0200)]
mmc: sdhci: Use sdhci_readl() not readl() in sdhci_dumpregs()
Use sdhci io wrappers consistently.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
c71024de98f4b596112be9c2698b2d8000382a5a)
Adrian Hunter [Mon, 20 Mar 2017 17:50:40 +0000 (19:50 +0200)]
mmc: sdhci: Add response register to register dump
Add response register to register dump.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
7962302fc3f5b3b31523b518a2dc47849fb7bd06)
Adrian Hunter [Mon, 20 Mar 2017 17:50:39 +0000 (19:50 +0200)]
mmc: sdhci: Improve debug print format
Ensure all debug prints start with the mmc host name.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
f421865d5b4ce57013040fb1700edceb43a14b42)
Adrian Hunter [Mon, 20 Mar 2017 17:50:38 +0000 (19:50 +0200)]
mmc: sdhci: Reduce spin lock usage in sdhci_execute_tuning
Tuning execution is already synchronized with respect to other host
operations by upper layers "claiming" the host, which also takes care of
runtime pm. There can be no requests in progress. Retain the spin lock
usage only for ensuring that sending tuning commands is synchronized with
respect to the interrupt handler.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
2a85ef25bee6910f4de510c5b574c81e87f38b05)
Adrian Hunter [Mon, 20 Mar 2017 17:50:36 +0000 (19:50 +0200)]
mmc: sdhci: Remove ->select_drive_strength() callback
Drivers can use the host operation directly, so remove this now unused
callback.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
0c62e6752d0c769aae41bfade6258e5f9aedbe2d)
Conflicts:
drivers/mmc/host/sdhci-pci.h
Adrian Hunter [Mon, 20 Mar 2017 17:50:32 +0000 (19:50 +0200)]
mmc: sdhci: Let drivers decide whether to use mmc_retune_needed() with pm
Devices might save and restore tuning values so that re-tuning might not be
needed after a pm transition. Let drivers decide by pushing the
mmc_retune_needed() logic down to them.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
d38dcad4e7b48f3d68d5d058f8f4f52a99862e6e)
Conflicts:
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/sdhci-pltfm.c
Adrian Hunter [Mon, 20 Mar 2017 17:50:31 +0000 (19:50 +0200)]
mmc: sdhci: Optimize delay loops
The delay loops for reset and clock enable always take at least 1 ms
because they use mdelay(1). However they can take a lot less time e.g. less
than 50us. Use ktime and reduce the delay to 10 microseconds per loop.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
(cherry picked from commit
5a436cc0af6202265de0d2d2d35f1b4fd85caf3b)
tcharding [Wed, 15 Mar 2017 08:48:04 +0000 (19:48 +1100)]
mmc: core: simplify return code
File contains multiple functions doing variations on the same thing,
sdio_readb(), sdio_writeb()f, sdio_readw(), sdio_writew()
etc. Although the functions have very similar logic the code is laid
out in a variety of ways. This makes it overly complicated to
read. There is a already a nice clean chunk of code, if we use this
format for all instances then we will have cleaned up the code,
reduced the line count and lessened the cognitive load required while
reading. Less lines equals less bugs.
Pick the most simple and clear code flow and change all functions to
be the same.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
8e11b284eaa86863f700216e4d3c87e7d7b3f44c)
tcharding [Wed, 15 Mar 2017 08:48:03 +0000 (19:48 +1100)]
mmc: core: guard dereference of optional parameter
Various functions take as parameter an optional pointer. Pointer
should be guarded with non-NULL check before dereferencing.
Add non-NULL check before dereference of pointer.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
9b980d950e5bcdce6dbc15a9c00ff960beeea28b)
Winkler, Tomas [Thu, 9 Mar 2017 14:58:21 +0000 (16:58 +0200)]
mmc: core: mmc_blk_rw_cmd_err - remove unused variable
Fix compilation warning:
drivers/mmc/core/block.c:1563:24: warning: variable ‘mq_rq’ set but not
used [-Wunused-but-set-variable] struct mmc_queue_req *mq_rq;
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
8bcd37d8b21de13d068414c018c9599281294a01)
Adrian Hunter [Mon, 13 Mar 2017 12:36:33 +0000 (14:36 +0200)]
mmc: block: Fix cmd error reset failure path
Commit
4e1f780032c5 ("mmc: block: break out mmc_blk_rw_cmd_abort()")
assumed the request had not completed, but in one case it had. Fix that.
Fixes:
4e1f780032c5 ("mmc: block: break out mmc_blk_rw_cmd_abort()")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
8ecc34448e24e9e8a8f3a9b37be70b43c6af5288)
Adrian Hunter [Mon, 13 Mar 2017 12:36:32 +0000 (14:36 +0200)]
mmc: block: Fix is_waiting_last_req set incorrectly
Commit
15520111500c ("mmc: core: Further fix thread wake-up") allowed a
queue to release the host with is_waiting_last_req set to true. A queue
waiting to claim the host will not reset it, which can result in the
queue getting stuck in a loop.
Fixes:
15520111500c ("mmc: core: Further fix thread wake-up")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org # v4.10+
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
2602b740e45cc64feb55d5a9ee8db744ab3becbb)
Shawn Lin [Wed, 15 Feb 2017 08:36:47 +0000 (16:36 +0800)]
mmc: core: add mmc prefix for blk_fixups
That makes all the quirks table look more consistent.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
8c7cdbf9272c300dc093da3c62fa3b4bc6dc960e)
Shawn Lin [Wed, 15 Feb 2017 08:35:31 +0000 (16:35 +0800)]
mmc: core: move all quirks together into quirks.h
It's not appreciated to place quirks everywhere, let's
put them together just like what we do for USB, PCI etc.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
0e9cfcf44e4aced8d45f409dcb48a0994fa77979)
Shawn Lin [Wed, 15 Feb 2017 08:35:30 +0000 (16:35 +0800)]
mmc: core: improve the quirks for sdio devices
Rename mmc_fixup_methods to sdio_fixup_methods to better
reflect that it's for sdio devices. So we could also pass
on it from sdio card's probe sequence just like what we do
for eMMC and block there.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
1144c1e4ddab9339e262e2702744e8f5c6220824)
Shawn Lin [Wed, 15 Feb 2017 08:35:29 +0000 (16:35 +0800)]
mmc: core: move some sdio IDs out of quirks file
Consolidate all the sdio devices' IDs into sdio_ids.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
884f38607897cb4a963ea8a65296f0973a2828d0)
Shawn Lin [Wed, 15 Feb 2017 08:35:28 +0000 (16:35 +0800)]
mmc: core: change quirks.c to be a header file
Rename quirks.c to quirks.h, and include it for
individual C files which need it.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
28fc64af63488d701184977481b263f31d856984)
Uri Yanai [Tue, 7 Feb 2017 16:00:01 +0000 (18:00 +0200)]
mmc: Adding AUTO_BKOPS_EN bit set for Auto BKOPS support
Adding dedicated flag for AUTO_BKOPS in card->ext_csd structure.
Read AUTO_BKOPS bit value from the device EXT_CSD and set to the
card->ext_csd structure.
In mmc_decode_ext_csd() add a print message in case the AUTO_BKOPS
is enabled
Signed-off-by: Uri Yanai <uri.yanai@sandisk.com>
Signed-off-by: Alex Lemberg <alex.lemberg@sandisk.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
efff8e7879b8b7f8a077f495262f0bb9cfaa0b06)
Uri Yanai [Tue, 7 Feb 2017 16:00:00 +0000 (18:00 +0200)]
mmc: MAN_BKOPS_EN inverse debug message logic
Inverse the logic for printing the debug message.
In mmc_decode_ext_csd() print message when MAN_BKOPS_EN is set
Signed-off-by: Uri Yanai <uri.yanai@sandisk.com>
Signed-off-by: Alex Lemberg <alex.lemberg@sandisk.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
6962c2fb201878722ef78b513dae7c22dfa4919c)
Linus Walleij [Wed, 1 Feb 2017 12:48:00 +0000 (13:48 +0100)]
mmc: core: start to break apart mmc_start_areq()
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: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
37dac0681e2be4f3c32b090a8c0591d4ce57e6f0)
Linus Walleij [Wed, 1 Feb 2017 12:47:58 +0000 (13:47 +0100)]
mmc: block: respect bool returned from blk_end_request()
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: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
0e65f10cf1774a27acf9e933e006f1e55a4ef642)
Linus Walleij [Wed, 1 Feb 2017 12:47:57 +0000 (13:47 +0100)]
mmc: block: return errorcode from mmc_sd_num_wr_blocks()
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: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[Ulf: Changed a return code to -EIO, reported by Dan Carpenter and fixed
by Linus Walleij]
(cherry picked from commit
169f03a064c230de6d715bdd62112eb12256fce3)
Linus Walleij [Wed, 1 Feb 2017 12:47:56 +0000 (13:47 +0100)]
mmc: queue: turn queue flags into bools
Instead of masking and setting two bits in the "flags" field
for the mmc_queue, just use two bools named "suspended" and
"new_request".
The masking and setting would likely have race conditions
anyways, it is better to use a simple member like this.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
9491be5ff06ff08d61e6a8d767382ea0037a6f38)
Linus Walleij [Wed, 1 Feb 2017 12:47:55 +0000 (13:47 +0100)]
mmc: block: rename mmc_active to areq
The mmc_active member of struct mmc_queue_req has a very
confusing name: this is certainly not always "active", it is
the asynchronous request associated by the mmc_queue_req
but it is not guaranteed to be "active" in any sense, such
as being running on the host.
Simply rename this member to "areq".
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
74f5ba357c7cd63c664e65fb7a116dbc0538a2ec)
Linus Walleij [Wed, 1 Feb 2017 12:47:54 +0000 (13:47 +0100)]
mmc: block: refactor mmc_blk_rw_try_restart()
The mmc_blk_rw_start_new() was named after the label inside
mmc_blk_issue_rw_rq() but is really a confusing name for this
function: what it does is to try to restart the latest issued
command on the host and card of the current MMC queue.
So rename it mmc_blk_rw_try_restart() that reflects what it
is doing and at this point also refactore the function to
treat the removed card as an exception and just exit if this
happens and run on in the function if that is not happening.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit
b2928e1049e1d96ac794293d18168c721dbfdb24)