Russell King [Fri, 28 Feb 2014 21:32:49 +0000 (21:32 +0000)]
mmc: sdhci-spear: use generic card detection gpio support
sdhci has support for using GPIOs for card detection. If we have a
GPIO specified, we can use that directly, without needing our own
interrupt handler.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Chris Ball <chris@printf.net>
Russell King [Fri, 28 Feb 2014 21:32:44 +0000 (21:32 +0000)]
mmc: sdhci-spear: remove support for power gpio
None of this code is currently used: there are no definitions of
struct sdhci_plat_data in arch/arm, neither are there any DT properties
which use card_power_gpio/power_active_high/power_always_enb. In any
case, slot power control should be rigged up via vmmc and the regulator
subsystem in the DT case.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Chris Ball <chris@printf.net>
Russell King [Fri, 28 Feb 2014 21:32:34 +0000 (21:32 +0000)]
mmc: sdhci-spear: fix platform_data usage
sdhci-spear is unsafe should a probe fail or defer, since it overwrites
the platform_data with its own driver-private data. It's trivial to
fix as SDHCI allows for driver-private data to be appended to its own
structure - we just need to arrange the code to allow this.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Chris Ball <chris@printf.net>
Russell King [Tue, 4 Mar 2014 21:25:51 +0000 (16:25 -0500)]
mmc: sdhci-bcm-kona: fix build errors when built-in
`sdhci_bcm_kona_remove' referenced in section `.data' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
Fixes: 058feb53666f ("mmc: sdhci-bcm-kona: make linker-section warning go away") Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Tested-by: Markus Mayer <markus.mayer@linaro.org> Acked-by: Matt Porter <mporter@linaro.org> Cc: <stable@vger.kernel.org> Signed-off-by: Chris Ball <chris@printf.net>
Balaji T K [Tue, 21 Jan 2014 14:24:42 +0000 (19:54 +0530)]
mmc: omap_hsmmc: fix request done for sbc error case
mrq is not populated for set block count(cmd23) command.
Use block read/write mmc_commond pointer for request done and
avoid NULL pointer access in error case for sbc (cmd23).
Signed-off-by: Balaji T K <balajitk@ti.com> Signed-off-by: Chris Ball <chris@printf.net>
Balaji T K [Tue, 21 Jan 2014 14:24:42 +0000 (19:54 +0530)]
mmc: omap_hsmmc: save clock rate to use in interrupt context
clk_get_rate throws DEBUG_LOCKS_WARN_ON(in_interrupt()) warning
if called from interrupt context.
use cached clock rate in set_data_timeout, so that
set_data_timeout can be called from interrupt context.
Signed-off-by: Balaji T K <balajitk@ti.com> Signed-off-by: Chris Ball <chris@printf.net>
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
mmc: omap_hsmmc: remove pbias workaround
remove pbias workaround
Signed-off-by: Balaji T K <balajitk@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Florian Vaussard <florian.vaussard@epfl.ch> Tested-by: Stefan Roese <sr@denx.de> Signed-off-by: Chris Ball <chris@printf.net>
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
Enable REGULATOR_PBIAS needed for SD card on most OMAPs.
Signed-off-by: Balaji T K <balajitk@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Florian Vaussard <florian.vaussard@epfl.ch> Tested-by: Stefan Roese <sr@denx.de> Signed-off-by: Chris Ball <chris@printf.net>
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
ARM: dts: add pbias dt node
Add pbias regulator node as a child of system control
module - syscon.
Signed-off-by: Balaji T K <balajitk@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Florian Vaussard <florian.vaussard@epfl.ch> Tested-by: Stefan Roese <sr@denx.de> Signed-off-by: Chris Ball <chris@printf.net>
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
In DT case, PBAIS registers are programmed via regulator,
use regulator APIs to control PBIAS.
Signed-off-by: Balaji T K <balajitk@ti.com> Tested-by: Florian Vaussard <florian.vaussard@epfl.ch> Tested-by: Stefan Roese <sr@denx.de> Signed-off-by: Chris Ball <chris@printf.net>
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
regulator: add pbias regulator support
pbias register controls internal power supply to sd card i/o pads
in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and
enabling/disabling are in the same PBIAS register.
Signed-off-by: Balaji T K <balajitk@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Mark Brown <broonie@linaro.org> Tested-by: Florian Vaussard <florian.vaussard@epfl.ch> Tested-by: Stefan Roese <sr@denx.de> Signed-off-by: Chris Ball <chris@printf.net>
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
mmc: omap_hsmmc: handle vcc and vcc_aux independently
handle vcc and vcc_aux independently to reduce indent.
Signed-off-by: Balaji T K <balajitk@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Florian Vaussard <florian.vaussard@epfl.ch> Tested-by: Stefan Roese <sr@denx.de> Signed-off-by: Chris Ball <chris@printf.net>
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
mmc: omap_hsmmc: use devm_regulator API
Use devm_regulator API, while at it use
devm_regulator_get_optional for optional vmmc_aux supply
Signed-off-by: Balaji T K <balajitk@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Florian Vaussard <florian.vaussard@epfl.ch> Tested-by: Stefan Roese <sr@denx.de> Signed-off-by: Chris Ball <chris@printf.net>
Daniel Mack [Mon, 17 Feb 2014 11:36:33 +0000 (12:36 +0100)]
mmc: omap_hsmmc: support more DT properties
This should probably be done implicitly through mmc_of_parse(), but that
doesn't play well along with the multi-slot model the hsmmc driver
features. Hence, for now, do it manually. The properties are already
documented in Documentation/devicetree/bindings/mmc/mmc.txt.
Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Balaji T K <balajitk@ti.com> Signed-off-by: Chris Ball <chris@printf.net>
Nishanth Menon [Fri, 14 Feb 2014 05:45:49 +0000 (23:45 -0600)]
ARM: dts: omap3-ldp: fix mmc configuration
MMC1 is the only MMC interface available on the platform. Further,
since the platform is based on older revision of SoC which is not
capable of doing multi-block reads, mark it with compatibility for the
same and add pinmux to ensure that all relevant pins are configured
for non-MMC boot mode.
Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Balaji T K <balajitk@ti.com> Signed-off-by: Chris Ball <chris@printf.net>
Nishanth Menon [Fri, 14 Feb 2014 05:45:48 +0000 (23:45 -0600)]
mmc: omap_hsmmc: Add support for quirky omap3 hsmmc controller
When device is booted using devicetree, platforms impacted by Erratum
2.1.1.128 is not detected easily in the mmc driver. This erratum
indicates that the module cannot do multi-block transfers. Platforms
such as LDP which use OMAP3 ES revision prior to ES3.0 are impacted by
this.
Provide a new compatible property "ti,omap3-pre-es3-hsmmc" to allow
driver to determine if driver needs to implement quirks associated
with the specific module version (primarily because the IP revision
information is not sufficient for the same).
Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Balaji T K <balajitk@ti.com> Signed-off-by: Chris Ball <chris@printf.net>
Felipe Balbi [Tue, 25 Feb 2014 14:57:44 +0000 (08:57 -0600)]
mmc: dw_mmc: fix possible build error
Fix the following build errors:
drivers/mmc/host/dw_mmc-k3.c: In function ‘dw_mci_k3_suspend’:
drivers/mmc/host/dw_mmc-k3.c:58:2: error: implicit declaration of
function ‘dw_mci_suspend’ [-Werror=implicit-function-declaration]
ret = dw_mci_suspend(host);
^
drivers/mmc/host/dw_mmc-k3.c: In function ‘dw_mci_k3_resume’:
drivers/mmc/host/dw_mmc-k3.c:76:2: error: implicit declaration of
function ‘dw_mci_resume’ [-Werror=implicit-function-declaration]
return dw_mci_resume(host);
^
drivers/mmc/host/dw_mmc-k3.c: At top level:
drivers/mmc/host/dw_mmc-k3.c:53:12: warning: ‘dw_mci_k3_suspend’ defined
but not used [-Wunused-function]
static int dw_mci_k3_suspend(struct device *dev)
^
drivers/mmc/host/dw_mmc-k3.c:65:12: warning: ‘dw_mci_k3_resume’ defined
but not used [-Wunused-function]
static int dw_mci_k3_resume(struct device *dev)
^
Signed-off-by: Felipe Balbi <balbi@ti.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <chris@printf.net>
Tomasz Figa [Sat, 11 Jan 2014 21:39:06 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Do not allow frequencies higher than requested
This patch modifies sdhci_s3c_consider_clock() to fail if bus clock
being considered can not provide frequency lower or equal requested,
instead of returning the lowest supported.
Tomasz Figa [Sat, 11 Jan 2014 21:39:05 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Fix handling of bus clock switching
Currently the driver assumes at probe that controller is configured for
last valid enumerated bus clock. This assumption is completely wrong, as
there is no way to ensure such configuration until the hardware gets
first configured (by calling sdhci_s3c_set_clock()).
This patch modifies the driver to set current clock at probe to unknown
state (represented by negative value) and make sure that the hardware
gets actually configured to selected clock in sdhci_s3c_set_clock().
This patch reimplements functions calculating minimum and maximum clock
rates to leverage clock rate cache introduced by previous patches.
In addition, the calculation is simplified to just comparing input
clock rates (max case) or input clock rates divided by maximum divisor
(min case), which is basically what the original code did, but with much
more unnecessary work.
Tomasz Figa [Sat, 11 Jan 2014 21:39:02 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Cache bus clock rates
To fix scheduling while atomic happening in sdhci_s3c_set_clock() caused
by calling clk_get_rate() that might sleep, this patch modifies the
driver to cache rates of all bus clocks at probe time and then only use
those cache values.
Tomasz Figa [Sat, 11 Jan 2014 21:39:01 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Use shifts to divide by powers of two
Current implementation of sdhci_s3c_consider_clock() is highly
inefficient due to multiple integer divisions by variable performed in a
loop. Since only divisors that are powers of two are considered, this
patch replaces them with respective shifts, removing all the integer
divisions.
Dinh Nguyen [Tue, 18 Feb 2014 02:31:02 +0000 (20:31 -0600)]
dts: socfpga: Add support for SD/MMC on the SOCFPGA platform
Introduce "altr,socfpga-dw-mshc" to enable Altera's SOCFPGA platform
specific implementation of the dw_mmc driver.
Also add the "syscon" binding to the "altr,sys-mgr" node. The clock
driver can use the syscon driver to toggle the register for the SD/MMC
clock phase shift settings.
Finally, fix an indentation error for the sysmgr node.
Dinh Nguyen [Tue, 18 Feb 2014 02:31:01 +0000 (20:31 -0600)]
mmc: dw_mmc: Add support for SOCFPGA's platform specific implementation
Like the rockchip, Altera's SOCFPGA platform specific implementation of the
dw_mmc driver requires using the HOLD register for SD commands. This patch
renames dw_mci_rockchip_prepare_command to dw_mci_pltfm_prepare_command so
that SOCFPGA and Rockchip can use it.
Dinh Nguyen [Tue, 18 Feb 2014 02:31:00 +0000 (20:31 -0600)]
mmc: dw_mmc-socfpga: Remove the SOCFPGA specific platform for dw_mmc
It turns now that the only really platform specific code that is needed for
SOCFPGA is using the SDMMC_CMD_USE_HOLD_REG in the prepare_command function.
Since the Rockchip already has this functionality, re-use the code that is
already in dw_mmc-pltfm.c.
Sachin Kamat [Tue, 25 Feb 2014 09:48:28 +0000 (15:18 +0530)]
mmc: dw_mmc: Fix NULL pointer dereference
If mrq->sbc is not NULL but data->stop happens to be NULL,
it will lead to NULL pointer dereferencing. Avoid this by
having a NULL check for data->stop.
Sachin Kamat [Tue, 25 Feb 2014 09:48:27 +0000 (15:18 +0530)]
mmc: mvsdio: Cleanup mmc-mvsdio.h header
Commit c02cecb92ed4 ("ARM: orion: move platform_data definitions")
moved the file to the current location but forgot to remove the pointer
to its previous location. Clean it up. While at it also change the header
file protection macros appropriately.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Sachin Kamat [Tue, 25 Feb 2014 09:48:26 +0000 (15:18 +0530)]
mmc: msm: Cleanup mmc-msm_sdcc.h header
Commit 1ef21f6343ff ("ARM: msm: move platform_data definitions")
moved the file to the current location but forgot to remove the pointer
to its previous location. Clean it up. While at it also change the header
file protection macros appropriately.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Sachin Kamat [Tue, 25 Feb 2014 09:48:25 +0000 (15:18 +0530)]
mmc: dw_mmc: Add missing description
Commit 0976f16d ("mmc: dw_mmc: add support tuning scheme") introduced
the execute_tuning hook but did not add its description for kernel docs.
Update the same.
Tim Kryger [Thu, 5 Dec 2013 19:20:41 +0000 (11:20 -0800)]
mmc: sdhci-bcm-kona: Add basic use of clocks
Enable the external clock needed by the host controller during the
probe and disable it during the remove.
Signed-off-by: Tim Kryger <tim.kryger@linaro.org> Reviewed-by: Markus Mayer <markus.mayer@linaro.org> Reviewed-by: Matt Porter <matt.porter@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Mon, 13 Jan 2014 15:49:31 +0000 (16:49 +0100)]
mmc: mmci: Enable support for busy detection for ux500 variant
The ux500 variants have HW busy detection support, which is indicated
by the busy_detect flag. For these variants let's enable the
MMC_CAP_WAIT_WHILE_BUSY flag and add the support for it.
The mmc core will provide the RSP_BUSY command flag for those requests
we should care about busy detection. Regarding the max_busy_timeout,
the HW don't support busy detection timeouts so at this initial step
let's make it simple and set it to zero to indicate we are able to
support any timeout.
Cc: Russell King <linux@arm.linux.org.uk> Cc: Johan Rudholm <jrudholm@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Fri, 10 Jan 2014 13:51:42 +0000 (14:51 +0100)]
mmc: mmci: Handle CMD irq before DATA irq
In case of a read operation both MCI_CMDRESPEND and MCI_DATAEND can be
set in the status register when entering the interrupt handler. This is
due to that the card start sending data before the host has
acknowledged the command response.
To resolve the issue for this scenario, we must start by handling the
CMD irq instead of the DATA irq. The reason is beacuse the completion
of the DATA irq will not respect the current command and then causing
it to be garbled.
Cc: Russell King <linux@arm.linux.org.uk> Cc: Johan Rudholm <jrudholm@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Tue, 14 Jan 2014 20:31:35 +0000 (21:31 +0100)]
mmc: block: Fixup busy detection while invoking stop cmd at recovery
When sending a stop command at the recovery path, use a R1B response
when the failing data request are a WRITE. Thus we also care about the
busy detection completion in this case.
For a failing READ request, we use a R1 response for the stop command,
since we don't need to care about busy detection in this case.
To align behavior between hosts supporting MMC_CAP_WAIT_WHILE_BUSY and
those who are not, we add a CMD13 polling method for the card's status.
We also respect whether the host has specified the max_busy_timeout,
which means we may fallback to CMD13 polling if the timeout is greater
than what the host are able to support.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Wed, 29 Jan 2014 12:11:27 +0000 (13:11 +0100)]
mmc: block: Respect hw busy detection in card_busy_detect()
Currently for write request we don't trust the hw busy detection to be
fully handled by host, thus we also poll the card's status until we see
it's gets out of the busy state.
Still there are scenarios where it will a benefit to trust the hw busy
detection done by the host, since no additional polling is needed.
Let's prepare card_busy_detect() to be able to handle this.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Wed, 29 Jan 2014 10:01:55 +0000 (11:01 +0100)]
mmc: block: Implement card_busy_detect() for busy detection
To complete a data write request we poll for the card's status register
by sending CMD13. The are other scenarios when this polling method are
needed, which is why we here moves this code to it's own function. No
functional change.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Tue, 14 Jan 2014 20:24:21 +0000 (21:24 +0100)]
mmc: block: Use R1 responses for stop cmds for read requests
While using open ended transmission and thus ending the transfer by
sending a stop command, we shall use R1B only for writes and R1 shall
be used for reads. Previously R1B were used in both cases.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Tue, 14 Jan 2014 22:17:36 +0000 (23:17 +0100)]
mmc: core: Respect host's max_busy_timeout when sending sleep cmd
When sending the sleep command for host drivers supporting
MMC_CAP_WAIT_WHILE_BUSY, we need to confirm that max_busy_timeout is
big enough comparing to the sleep timeout specified from card's
EXT_CSD. If this isn't case, we use a R1 response instead of R1B and
fallback to use a delay instead.
Do note that a max_busy_timeout set to zero by the host, is interpreted
as it can cope with whatever timeout the mmc core provides it with.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Tue, 28 Jan 2014 13:15:34 +0000 (14:15 +0100)]
mmc: core: Fixup busy detection for mmc switch operations
If the host controller supports busy detection in HW, we expect the
MMC_CAP_WAIT_WHILE_BUSY to be set. Likewise the corresponding
host->max_busy_timeout should reflect the maximum busy detection
timeout supported by the host.
Previously we expected a host that supported MMC_CAP_WAIT_WHILE_BUSY to
cope with any timeout, which just isn't feasible due to HW limitations.
For most switch operations, R1B responses are expected and thus we need
to check for busy detection completion. To cope with cases where the
requested busy detection timeout is greater than what the host are able
to support, we fallback to use a R1 response instead. This will prevent
the host from doing HW busy detection.
In those cases, busy detection completion is handled by polling the for
the card's status using CMD13. This is the same mechanism used when the
host doesn't support MMC_CAP_WAIT_WHILE_BUSY.
Do note, a host->max_busy_timeout set to zero, is interpreted by the
mmc core as it don't know what the host supports. It will then provide
the host with whatever timeout the mmc core finds suitable.
For some cases the mmc core has unfurtunate no clue of what timeout to
use. In these cases we provide the host with a timeout value of zero,
which the host may interpret as use whatever timeout it finds suitable.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Tue, 28 Jan 2014 13:05:39 +0000 (14:05 +0100)]
mmc: core: Minor simplifications to __mmc_switch
Instead of using several references to card->host, let's use a local
variable. That means we can remove the BUG_ON verifications for the
same pointers.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Wed, 18 Dec 2013 08:57:38 +0000 (09:57 +0100)]
mmc: core: Rename max_discard_to to max_busy_timeout
Rename host->max_discard_to to host->max_busy_timeout, to reflect that
it tells the mmc core layer about the maximum supported busy detection
timeout by the host.
This timeout is at the moment only applicable to erase/trim/discard
commands. By the renaming we provide the option of make use of it for
other commands that cares about busy detection. In other words, those
commands that wants an R1B response, like for example the mmc switch
command.
Do note that the max_busy_timeout is supposed to be specified only by
hosts supporting MMC_CAP_WAIT_WHILE_BUSY.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Micky Ching [Mon, 17 Feb 2014 08:45:48 +0000 (16:45 +0800)]
mmc: rtsx: add support for pre_req and post_req
Add support for non-blocking request, pre_req() runs dma_map_sg() and
post_req() runs dma_unmap_sg(). This patch can increase card read/write
speed, especially for high speed card and slow CPU(for some embedded
platform).
Users can get a great benefit from this patch. if CPU frequency is 800MHz,
SDR104 or DDR50 card read/write speed may increase more than 15%.
test results:
intel i3(800MHz - 2.3GHz), SD card clock 208MHz
Micky Ching [Mon, 17 Feb 2014 08:45:46 +0000 (16:45 +0800)]
mmc: rtsx: fix card poweroff bug
If the host driver removed while card in the slot, the host will not
power off card power correctly. This bug is produced because host
eject flag set before the last mmc_set_ios callback, we should set the
eject flag after power off.
Signed-off-by: Micky Ching <micky_ching@realsil.com.cn> Signed-off-by: Chris Ball <chris@printf.net>
Jarkko Nikula [Sat, 22 Feb 2014 16:01:43 +0000 (18:01 +0200)]
mmc: omap: Add erase capability
This patch adds the erase capability to OMAP1/OMAP2420 MMC driver. Idea is
the same than in commit 93caf8e ("omap_hsmmc: add erase capability") that we
disable the data timeout interrupt for erases.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Chris Ball <chris@printf.net>
Jarkko Nikula [Sat, 22 Feb 2014 16:01:42 +0000 (18:01 +0200)]
mmc: omap: Remove always set use_dma flag from struct mmc_omap_host
Because use_dma is set only in mmc_omap_probe and unset nowhere there is no
need to carry that flag in struct mmc_omap_host for mmc_omap_prepare_data
function.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Chris Ball <chris@printf.net>
Jarkko Nikula [Sat, 22 Feb 2014 16:01:41 +0000 (18:01 +0200)]
mmc: omap: Convert to devm_ioremap_resource
Simplify probe and cleanup code by using devm_ioremap_resource. This also
makes probe code to follow more common allocate private struct followed by
other initialization style.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Chris Ball <chris@printf.net>
Jarkko Nikula [Sat, 22 Feb 2014 16:01:40 +0000 (18:01 +0200)]
mmc: omap: Remove mem_res field from struct mmc_omap_host
Field mem_res in struct mmc_omap_host is used only once in mmc_omap_probe
when setting the phys_base field so we may just se the phys_base straight
and remove needless mem_res.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Chris Ball <chris@printf.net>
Jarkko Nikula [Sat, 22 Feb 2014 16:01:39 +0000 (18:01 +0200)]
mmc: omap: Remove duplicate host->irq assignment
host-irq is set twice so remove needless one.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Chris Ball <chris@printf.net>
Jarkko Nikula [Sat, 22 Feb 2014 16:01:38 +0000 (18:01 +0200)]
mmc: omap: Convert to devm_kzalloc
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Chris Ball <chris@printf.net>
Jarkko Nikula [Sat, 22 Feb 2014 16:01:37 +0000 (18:01 +0200)]
mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet
Omap MMC driver initialization can cause a NULL pointer dereference in
tasklet_hi_action on Nokia N810 if its miniSD cover is open during driver
initialization.
[ 1.070000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 1.080000] pgd = c0004000
[ 1.080000] [00000000] *pgd=00000000
[ 1.080000] Internal error: Oops: 80000005 [#1] PREEMPT ARM
[ 1.080000] Modules linked in:
[ 1.080000] CPU: 0 PID: 24 Comm: kworker/0:1 Not tainted 3.13.0-rc2+ #95
[ 1.080000] Workqueue: events menelaus_work
[ 1.080000] task: c7863340 ti: c7878000 task.ti: c7878000
[ 1.080000] PC is at 0x0
[ 1.080000] LR is at tasklet_hi_action+0x68/0xa4
...
[ 1.080000] [<c003543c>] (tasklet_hi_action+0x68/0xa4) from [<c0034dd0>] (__do_softirq+0xbc/0x208)
[ 1.080000] [<c0034dd0>] (__do_softirq+0xbc/0x208) from [<c003521c>] (irq_exit+0x84/0xac)
[ 1.080000] [<c003521c>] (irq_exit+0x84/0xac) from [<c00135cc>] (handle_IRQ+0x64/0x84)
[ 1.080000] [<c00135cc>] (handle_IRQ+0x64/0x84) from [<c000859c>] (omap2_intc_handle_irq+0x54/0x68)
[ 1.080000] [<c000859c>] (omap2_intc_handle_irq+0x54/0x68) from [<c0015be0>] (__irq_svc+0x40/0x74)
[ 1.080000] Exception stack(0xc7879d70 to 0xc7879db8)
[ 1.080000] 9d60: 000003f10000000a000000090000001c
[ 1.080000] 9d80: c7879e70c780bc10c780bc10000000000000000100008603c780bc78c7879e4e
[ 1.080000] 9da0: 00000002c7879db8c00343b0c0160c9c20000113ffffffff
[ 1.080000] [<c0015be0>] (__irq_svc+0x40/0x74) from [<c0160c9c>] (__aeabi_uidiv+0x20/0x9c)
[ 1.080000] [<c0160c9c>] (__aeabi_uidiv+0x20/0x9c) from [<c00343b0>] (msecs_to_jiffies+0x18/0x24)
[ 1.080000] [<c00343b0>] (msecs_to_jiffies+0x18/0x24) from [<c01ec3ec>] (omap_i2c_xfer+0x30c/0x458)
[ 1.080000] [<c01ec3ec>] (omap_i2c_xfer+0x30c/0x458) from [<c01e9724>] (__i2c_transfer+0x3c/0x74)
[ 1.080000] [<c01e9724>] (__i2c_transfer+0x3c/0x74) from [<c01eac4c>] (i2c_transfer+0x78/0x94)
[ 1.080000] [<c01eac4c>] (i2c_transfer+0x78/0x94) from [<c01eb0bc>] (i2c_smbus_xfer+0x3c0/0x4f8)
[ 1.080000] [<c01eb0bc>] (i2c_smbus_xfer+0x3c0/0x4f8) from [<c01eb414>] (i2c_smbus_write_byte_data+0x34/0x3c)
[ 1.080000] [<c01eb414>] (i2c_smbus_write_byte_data+0x34/0x3c) from [<c01bb308>] (menelaus_write_reg+0x1c/0x40)
[ 1.080000] [<c01bb308>] (menelaus_write_reg+0x1c/0x40) from [<c01bb904>] (menelaus_work+0xa0/0xc4)
[ 1.080000] [<c01bb904>] (menelaus_work+0xa0/0xc4) from [<c00439c4>] (process_one_work+0x1fc/0x334)
[ 1.080000] [<c00439c4>] (process_one_work+0x1fc/0x334) from [<c0043d6c>] (worker_thread+0x244/0x380)
[ 1.080000] [<c0043d6c>] (worker_thread+0x244/0x380) from [<c0049d04>] (kthread+0xc0/0xd4)
[ 1.080000] [<c0049d04>] (kthread+0xc0/0xd4) from [<c0012758>] (ret_from_fork+0x14/0x3c)
[ 1.080000] Code: bad PC value
[ 1.090000] ---[ end trace 7bc2fc7cd14f1d95 ]---
[ 1.100000] Kernel panic - not syncing: Fatal exception in interrupt
Reason for this is that omap_notify_cover_event which calls
tasklet_hi_schedule gets called before struct cover_tasklet is initialized.
Call to omap_notify_cover_event on Nokia N810 happens from menelaus.c PMIC
driver via board-n8x0.c during execution of mmc_add_host in case of open
miniSD cover.
Fix this by moving cover_timer and cover_tasklet initialization before
mmc_add_host call in mmc_omap_new_slot.
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Tony Lindgren <tony@atomide.com> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Chris Ball <chris@printf.net>
Ulf Hansson [Wed, 18 Dec 2013 10:59:17 +0000 (11:59 +0100)]
mmc: core: Enable MMC_CAP2_CACHE_CTRL as default
There are no reason to why the use of a non-volatile internal eMMC
cache should be controlled by a host cap. Instead let's just enable it
if the eMMC card supports it.
Ulf Hansson [Mon, 16 Dec 2013 13:46:00 +0000 (14:46 +0100)]
mmc: core: Remove support for MMC_CAP2_NO_SLEEP_CMD
There are no active users of this host capability. The primary reason
for adding this cap was due to a bug in ux500 boot loader code, which
is not a relevant issue any more. So, let's remove it.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Linus Torvalds [Mon, 10 Feb 2014 02:14:53 +0000 (18:14 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull SELinux fixes from James Morris.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
SELinux: Fix kernel BUG on empty security contexts.
selinux: add SOCK_DIAG_BY_FAMILY to the list of netlink message types
Linus Torvalds [Mon, 10 Feb 2014 02:12:07 +0000 (18:12 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fixes from Al Viro:
"A couple of fixes, both -stable fodder. The O_SYNC bug is fairly
old..."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fix a kmap leak in virtio_console
fix O_SYNC|O_APPEND syncing the wrong range on write()
Al Viro [Sun, 2 Feb 2014 12:05:05 +0000 (07:05 -0500)]
fix a kmap leak in virtio_console
While we are at it, don't do kmap() under kmap_atomic(), *especially*
for a page we'd allocated with GFP_KERNEL. It's spelled "page_address",
and had that been more than that, we'd have a real trouble - kmap_high()
can block, and doing that while holding kmap_atomic() is a Bad Idea(tm).
Al Viro [Sun, 9 Feb 2014 20:18:09 +0000 (15:18 -0500)]
fix O_SYNC|O_APPEND syncing the wrong range on write()
It actually goes back to 2004 ([PATCH] Concurrent O_SYNC write support)
when sync_page_range() had been introduced; generic_file_write{,v}() correctly
synced
pos_after_write - written .. pos_after_write - 1
but generic_file_aio_write() synced
pos_before_write .. pos_before_write + written - 1
instead. Which is not the same thing with O_APPEND, obviously.
A couple of years later correct variant had been killed off when
everything switched to use of generic_file_aio_write().
All users of generic_file_aio_write() are affected, and the same bug
has been copied into other instances of ->aio_write().
The fix is trivial; the only subtle point is that generic_write_sync()
ought to be inlined to avoid calculations useless for the majority of
calls.
Linus Torvalds [Sun, 9 Feb 2014 19:12:26 +0000 (11:12 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason:
"This is a small collection of fixes"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
Btrfs: fix data corruption when reading/updating compressed extents
Btrfs: don't loop forever if we can't run because of the tree mod log
btrfs: reserve no transaction units in btrfs_ioctl_set_features
btrfs: commit transaction after setting label and features
Btrfs: fix assert screwup for the pending move stuff
Linus Torvalds [Sun, 9 Feb 2014 18:09:49 +0000 (10:09 -0800)]
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar:
"Tooling fixes, mostly related to the KASLR fallout, but also other
fixes"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf buildid-cache: Check relocation when checking for existing kcore
perf tools: Adjust kallsyms for relocated kernel
perf tests: No need to set up ref_reloc_sym
perf symbols: Prevent the use of kcore if the kernel has moved
perf record: Get ref_reloc_sym from kernel map
perf machine: Set up ref_reloc_sym in machine__create_kernel_maps()
perf machine: Add machine__get_kallsyms_filename()
perf tools: Add kallsyms__get_function_start()
perf symbols: Fix symbol annotation for relocated kernel
perf tools: Fix include for non x86 architectures
perf tools: Fix AAAAARGH64 memory barriers
perf tools: Demangle kernel and kernel module symbols too
perf/doc: Remove mention of non-existent set_perf_event_pending() from design.txt
Btrfs: fix data corruption when reading/updating compressed extents
When using a mix of compressed file extents and prealloc extents, it
is possible to fill a page of a file with random, garbage data from
some unrelated previous use of the page, instead of a sequence of zeroes.
A simple sequence of steps to get into such case, taken from the test
case I made for xfstests, is:
This results in the following file items in the fs tree:
item 4 key (257 INODE_ITEM 0) itemoff 15879 itemsize 160
inode generation 6 transid 6 size 542872 block group 0 mode 100600
item 5 key (257 INODE_REF 256) itemoff 15863 itemsize 16
inode ref index 2 namelen 6 name: foobar
item 6 key (257 EXTENT_DATA 0) itemoff 15810 itemsize 53
extent data disk byte 0 nr 0 gen 6
extent data offset 0 nr 24576 ram 266240
extent compression 0
item 7 key (257 EXTENT_DATA 24576) itemoff 15757 itemsize 53
prealloc data disk byte 12849152 nr 241664 gen 6
prealloc data offset 0 nr 241664
item 8 key (257 EXTENT_DATA 266240) itemoff 15704 itemsize 53
extent data disk byte 12845056 nr 4096 gen 6
extent data offset 0 nr 20480 ram 20480
extent compression 2
item 9 key (257 EXTENT_DATA 286720) itemoff 15651 itemsize 53
prealloc data disk byte 13090816 nr 405504 gen 6
prealloc data offset 0 nr 258048
The on disk extent at offset 266240 (which corresponds to 1 single disk block),
contains 5 compressed chunks of file data. Each of the first 4 compress 4096
bytes of file data, while the last one only compresses 3024 bytes of file data.
Therefore a read into the file region [285648 ; 286720[ (length = 4096 - 3024 =
1072 bytes) should always return zeroes (our next extent is a prealloc one).
The solution here is the compression code path to zero the remaining (untouched)
bytes of the last page it uncompressed data into, as the information about how
much space the file data consumes in the last page is not known in the upper layer
fs/btrfs/extent_io.c:__do_readpage(). In __do_readpage we were correctly zeroing
the remainder of the page but only if it corresponds to the last page of the inode
and if the inode's size is not a multiple of the page size.
This would cause not only returning random data on reads, but also permanently
storing random data when updating parts of the region that should be zeroed.
For the example above, it means updating a single byte in the region [285648 ; 286720[
would store that byte correctly but also store random data on disk.
A test case for xfstests follows soon.
Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Chris Mason <clm@fb.com>
Josef Bacik [Fri, 7 Feb 2014 18:57:59 +0000 (13:57 -0500)]
Btrfs: don't loop forever if we can't run because of the tree mod log
A user reported a 100% cpu hang with my new delayed ref code. Turns out I
forgot to increase the count check when we can't run a delayed ref because of
the tree mod log. If we can't run any delayed refs during this there is no
point in continuing to look, and we need to break out. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
David Sterba [Fri, 7 Feb 2014 13:34:04 +0000 (14:34 +0100)]
btrfs: reserve no transaction units in btrfs_ioctl_set_features
Added in patch "btrfs: add ioctls to query/change feature bits online"
modifications to superblock don't need to reserve metadata blocks when
starting a transaction.
Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>