This patch calls pm_runtime_put_noidle() to restore the device's usage
counter in the ->remove() implementation.
Signed-off-by: Jisheng Zhang <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Commit 0dcaa2499b ("sdhci-pxav3: Fix runtime PM initialization") tries
to fix one hang issue caused by calling sdhci_add_host() on a suspended
device. The fix enables the clock twice, once by clk_prepare_enable() and
another by pm_runtime_get_sync(), meaning that the clock will never be
gated at runtime PM suspend. I observed the power consumption regression on
Marvell BG2Q SoCs.
In fact, the fix is not correct. There still be a very small window
during which a runtime suspend might somehow occur after pm_runtime_enable()
but before pm_runtime_get_sync().
This patch fixes all of the two problems by just incrementing the usage
counter before pm_runtime_enable(). It also adjust the order of disabling
runtime pm and storing the usage count in the error path to handle clock
gating properly.
Signed-off-by: Jisheng Zhang <[email protected]>
Cc: <[email protected]> # v3.11+
Signed-off-by: Ulf Hansson <[email protected]>
There is no point making the initialization
of buf_ready_int conditional on host version.
Simplify by just doing it always. Note that
the other conditional initializations will be
removed when the new way of doing re-tuning
is taken into use.
Signed-off-by: Adrian Hunter <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Both callers of mmc_start_request() call mmc_card_removed()
so move that call into mmc_start_request().
This patch is preparation for adding re-tuning support.
Signed-off-by: Adrian Hunter <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
For each MMC, SD and SDIO there is code that
holds the clock, calls ops->execute_tuning, and
releases the clock. Simplify the code a bit by
providing a separate function to do that.
Signed-off-by: Adrian Hunter <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
This ensures that all standard options are available to hsmmc,
In particular, I need cap-power-off-card.
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Using the common code removes some code duplication, and
makes it easier to switch to using mmc_of_parse() which
will remove more duplication.
This uses the new mmc_gpio_request_cd_isr to provide a non-standard
interrupt service routine for card-detect interrupts.
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
One of the reasons omap_hsmmc doesn't use the slot-gpio library
is that it has some non-standard functionality in the card-detect
interrupt service routine.
To make it possible for omap_hsmmc (and maybe others) to be converted
to use slot-gpio, add 'mmc_gpio_request_cd_isr' which provide an
alternate isr to be register by the slot-gpio code.
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Enable power cycle and re-initialization of SD cards via the reset
bus_ops. Power cycling a buggy SD card sometimes helps it get back on
track.
Signed-off-by: Johan Rudholm <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Move the (e)MMC specific hw_reset code from core.c into mmc.c. Call the
code from the new bus_ops member "reset". This also allows for adding
a SD card specific reset procedure.
Signed-off-by: Johan Rudholm <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Always check if the card is alive after a successful reset. This allows
us to remove mmc_hw_reset_check(), leaving mmc_hw_reset() as the only
card reset interface.
Signed-off-by: Johan Rudholm <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
This adds SDIO devicetree subnode parsing to the mmc core. While
SDIO devices are runtime probable they sometimes need nonprobable
additional information on embedded systems, like an additional gpio
interrupt or a clock. This patch makes it possible to supply this
information from the devicetree. SDIO drivers will find a pointer
to the devicenode in their devices of_node pointer.
Signed-off-by: Sascha Hauer <[email protected]>
[[email protected]: Misc. cleanups]
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
While SDIO devices are runtime probable they sometimes need nonprobable
additional information on embedded systems, like an additional gpio
interrupt or a clock. This binding describes how to add child nodes to the
devicetree to supply this information.
Signed-off-by: Sascha Hauer <[email protected]>
[[email protected]: Documented the need for #address- and #size-cells]
[[email protected]: Added a real world example]
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
The bounce buffer, used for misaligned bytes for ADMA access,
resides wholly within the (align_sz)-aligned word, just by construction.
The page addresses are aligned to (align_sz), either for 4 or 8 bytes
alignment, so that the aligned word resides wholly within a single page
and can't cross the page boundary. So, the bounce buffer can't cross
the page boundary too. That's why the warnings are never hit, and can
be safely removed.
Signed-off-by: Andrew Gabbasov <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Since previous patches removed the need for the tuning block patterns
to be exported, let's move them close to the mmc_send_tuning() API.
Those are now intended to be used only by the mmc core.
Signed-off-by: Ulf Hansson <[email protected]>
Reviewed-by: Stephen Boyd <[email protected]>
Acked-by: Jaehoon Chung <[email protected]>
Instead of having a local hack taking care of sending the tuning
command and as well to verify the response pattern, let's convert to
the common mmc_send_tuning() API.
This change affects the Exynos variant, since it's the only one which
support the dw_mmc's ->execute_tuning() callback.
It's seems like dw_mmc internal logic expects failed data transfers to
be ended using a stop command. Let the tuning requests also fall into
this category, since there are data transfer involved.
Signed-off-by: Ulf Hansson <[email protected]>
Acked-by: Jaehoon Chung <[email protected]>
Reviewed-by: Alim Akhtar <[email protected]>
Tested-by: Alim Akhtar <[email protected]>
Previously the pm_runtime_put() caused the device to be runtime PM
suspended, but then immediately being resumed when we add the host.
Prevent this unnecessary runtime PM suspend/resume cycle during
->probe() by moving the call to pm_runtime_put() after mmc_add_host().
Signed-off-by: Ulf Hansson <[email protected]>
By configure runtime PM prior we enable the use of it, we close the gap
for strange and unhandled conditions. Moreover it makes us rely on the
driver core, after finalized ->probe(), to request an inactive device
to become runtime PM idle/suspended, which earlier potentially could
happen already at pm_runtime_set_autosuspend_delay().
Signed-off-by: Ulf Hansson <[email protected]>
Since sdhci_remove_host() access the device, we need to make sure it's
runtime PM resumed.
To handle clock gating properly in remove, we first have to make sure
the clocks are ungated.
To fix both these issues, by invoking pm_runtime_get_sync() early in
->remove() callback. Later once we disabled runtime PM, we can restore
the usage count.
Signed-off-by: Ulf Hansson <[email protected]>
Since commit ab78029ecc (drivers/pinctrl: grab default handles from device
core), we can rely on device core for setting the default pins.
Signed-off-by: Wolfram Sang <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Modify transfer mode for support sdio card,
send cmd and data at the same time for read data transfer,
but send data after cmd for write data transfer.
Signed-off-by: Micky Ching <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
To support sdio card, transfer mode need make a change,
this need to split code and use it in different place,
Add new function to simplify repeat operation.
Signed-off-by: Micky Ching <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
host->cookie is used for handle async request,
we should init it to negative value when new card inserted,
make cookie value invalid.
Signed-off-by: Micky Ching <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Add a new function to dump register within a range.
We print 1 register a line before this patch,
this may make debug info too long when we add more register to dump.
The new dump_reg_range() dump to 8 register a line,
and it is easy to use.
Signed-off-by: Micky Ching <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
By moving the allocation of the slot-gpio data into mmc_alloc_host(),
we can remove the slot-gpio internal calls to mmc_gpio_alloc().
This means mmc_gpio_alloc() has now only one caller left, which
consequence allow us to simplify and remove some of the slot-gpio code.
Additionally, this makes the slot-gpio mutex redundant, so let's remove
it.
Signed-off-by: Ulf Hansson <[email protected]>
To be consistent when freeing data, let's move the idr_remove() call
from mmc_free_host() into the ->dev_release() callback for the class
device.
Signed-off-by: Ulf Hansson <[email protected]>
As a step in moving slot-gpio functions/structs closer to the MMC core,
let's add a local header file for slot-gpio.
In this initial step we move mmc_gpio_alloc() into the header file,
to make it available for the MMC core. Following patches will show the
utilization of it.
Signed-off-by: Ulf Hansson <[email protected]>
We had a mix of using the class device and the parent device while
allocating data through the devm_* managed functions.
Let's be more consistent and always use the parent device.
Signed-off-by: Ulf Hansson <[email protected]>
The slot-gpio uses the devm*_ managed functions. Still it provide APIs
to explicitly free requested CD/WP GPIOs, but these API isn't being
used.
Therefore let's simplify slot-gpio by removing these unused APIs. If it
later turns out we need some of them, we can always consider to restore
the code.
Signed-off-by: Ulf Hansson <[email protected]>
The MMC core makes use of the devm_* functions while requesting the
CD/WP GPIOs, let's rely on that.
Cc: Barry Song <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
The MMC core makes use of the devm_* functions while requesting the
CD/WP GPIOs, let's rely on that.
Cc: Nicolas Pitre <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Instead of just printing an error when mmc_of_parse() fails to request
CD/WP GPIO pins, let's propagate all errors, except for -ENOENT.
Earlier only -EPROBE_DEFER was handled correctly.
As a side effect of this change and by relying on host drivers to
handle the errors during ->probe(), we don't need to free any data in
the error path.
This also means we are actually fixing a bug, since we remove the call
to mmc_gpio_free_cd() which wasn't the correct function to invoke to
handle cleanup. Instead that should have been mmc_gpiod_free_cd().
Signed-off-by: Ulf Hansson <[email protected]>
Since mmc_of_parse() may fail, let's deal with it and thus do proper
error handling.
Cc: Jaehoon Chung <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Acked-by: Jaehoon Chung <[email protected]>
Since mmc_of_parse() may fail, let's deal with it and thus do proper
error handling.
Cc: Jonas Jensen <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Move exynos related definition to header file. And this
also changes some of the registers name to match the standard
naming convention.
Signed-off-by: Seungwon Jeon <[email protected]>
Acked-by: Jaehoon Chung <[email protected]>
[Alim: updated the commit message]
Signed-off-by: Alim Akhtar <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Even though 1MB is reserved for descriptor table in IDMAC,
the dw_mmc host driver is allowed to receive only maximum
128KB block length in one request. This is caused by setting
improper max_blk_count. It needs to be e adjusted so that
descriptor table is used fully. It is found that the performance
is improved with the increased the max_blk_count.
Signed-off-by: Seungwon Jeon <[email protected]>
Acked-by: Jaehoon Chung <[email protected]>
Signed-off-by: Alim Akhtar <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Static checkers complain about the inconsistent NULL checking here:
drivers/mmc/host/mxs-mmc.c:680 mxs_mmc_probe()
warn: variable dereferenced before check 'ssp->dmach' (see line 660)
The variable can't actually be NULL so we can remove the check.
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Removing a relict from reverse engineering of the Android driver code
in sunxi_mmc_clk_set_rate.
Signed-off-by: David Lanzendörfer <[email protected]>
Reported-by: <[email protected]>
Acked-by: Hans de Goede <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Fixing the register name in sunxi_mmc_reset_host since the
SDXC_HARDWARE_RESET bit is actually located within REG_GCTRL and not
REG_CMDR as it was pointed out by Allwinner.
Signed-off-by: David Lanzendörfer <[email protected]>
Reported-by: <[email protected]>
Acked-by: Hans de Goede <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
1) Adding a comment in order to clarify the choice of the locks within
sunxi_mmc_handle_manual_stop
2) As <[email protected]> has pointed out the wait_dma variable
was not accessed within the spin lock block in sunxi_mmc_request and so
(even if it should never happend) it would have theoretically been
possible that some other function would access the variable at the same
time as the function. This has been changed now and the function is
using local variables outside the lock and copys the value over during
the lock phase.
Signed-off-by: David Lanzendörfer <[email protected]>
Reported-by: <[email protected]>
Acked-by: Hans de Goede <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>