Wolfram Sang
03d80e042a
Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD cards"
...
This reverts commit db1af1e971 . It was
only a workaround to hide a regression. We now have proper fixes.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20201106072549.1495-4-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-11-10 13:58:01 +01:00
Yoshihiro Shimoda
e8973201d9
mmc: renesas_sdhi_core: Add missing tmio_mmc_host_free() at remove
...
The commit 94b110aff8 ("mmc: tmio: add tmio_mmc_host_alloc/free()")
added tmio_mmc_host_free(), but missed the function calling in
the sh_mobile_sdhi_remove() at that time. So, fix it. Otherwise,
we cannot rebind the sdhi/mmc devices when we use aliases of mmc.
Fixes: 94b110aff8 ("mmc: tmio: add tmio_mmc_host_alloc/free()")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/1604654730-29914-1-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-11-10 13:15:19 +01:00
Wolfram Sang
db1af1e971
mmc: renesas_sdhi: workaround a regression when reinserting SD cards
...
After the conversions of the reset routines, re-inserting SD cards
didn't work anymore. Apply this temporary workaround to have working SD
cards during the merge window. The issue will be fixed properly until
the final release.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Link: https://lore.kernel.org/r/20201008092533.76588-1-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-10-08 11:41:12 +02:00
Wolfram Sang
fbb31330f9
mmc: renesas_sdhi: drop local flag for tuning
...
The MMC core has now a generic check if some tuning is in progress. Its
protected area is a bit larger than the custom one in this driver but we
concluded that this works equally well for the intended case. So, drop
the local flag and switch to the generic one.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200922172253.4458-1-wsa@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-09-25 13:24:02 +02:00
Wolfram Sang
ce6f92c280
mmc: renesas_sdhi: support manual calibration
...
Some R-Car Gen3 SoCs need some manual correction of timing parameters
after the automatic tuning has finished but before next CMD13 is
completed. This patch implements that by this state machine:
- introducing a per-SoC correction table if needed
- iff such a table exists, the 'fixup_request' callback is populated
during probe
- iff such a table exists, a runtime flag ('needs_adjust_hs400')
is set when HS400 tuning was completed
- the callback will check the runtime flag and enable the corrected
manual mode if the flag is set and CMD13 is encountered
- at the end of the enablement the runtime flag is cleared
- iff the configuration flag is set, the manual mode will be disabled
when HS400 gets downgraded
There also some helper functions added to access the TMPPORT registers.
The actual correction table is SoC and instance(!) specific and is
added to the quirks struct.
Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com >
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Link: https://lore.kernel.org/r/20200902081812.1591-3-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-09-09 13:09:44 +02:00
Wolfram Sang
0f93db6542
mmc: renesas_sdhi: keep SCC clock active when tuning
...
Tuning procedure switches to lower frequencies but that will turn the
SCC off and accessing its register then will hang. So, check when we are
tuning and keep the current setup of the external clock if we are doing
so. Note that we still switch to the lower frequency because of the
internal divider. We just make sure to not modify the external clock.
This patch depends on a MMC core patch calling the downgrade function
earlier.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200901150250.26236-4-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-09-07 09:16:32 +02:00
Wolfram Sang
510bfe5893
mmc: tmio: remove indirection of 'execute_tuning' callback
...
After all the previous refactorization, we can now populate mmc_ops
directly and don't need a layer inbetween. The NULL-pointer check and
the error printout are already done by the MMC core.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200820132538.24758-7-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-09-07 09:11:31 +02:00
Wolfram Sang
5b0739d762
mmc: tmio: don't reset whole IP core when tuning fails
...
SDHI needs to reset the SCC only, not the whole IP core. So, if tuning
fails, don't handle specifics in the generic TMIO core, but in the
specific drivers. For SDHI, we need to move around the reset routine a
bit. It is not modified.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200820132538.24758-6-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-09-07 09:11:31 +02:00
Wolfram Sang
576146ea4e
mmc: tmio: factor out common parts of the reset routine
...
Some TMIO variants need specific actions in their reset routine, but
they are all based on a generic reset routine. So, the optional 'reset'
callback will now only take care of the additional stuff and we will
have a generic function around it. Less code, easier to maintain, and
much more readable. Code in tmio_mmc.c is untested but in my TC6387XB
datasheet the SDIO part is reset independently from the SD part, too.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200820132538.24758-5-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-09-07 09:11:31 +02:00
Wolfram Sang
6e7d4de108
mmc: renesas_sdhi: move wrong 'hw_reset' to 'reset'
...
This driver got the usage of 'hw_reset' wrong and missed that it is used
to reset the remote HW (card) only, not the local one (controller). Move
everything to the proper 'reset' callback. Also, add the generic reset
code from TMIO, so we will ensure the same behaviour (it will get
refactored away in a later patch). This also means we need to drop
MMC_CAP_HW_RESET because this is currently not supported by our
hardware.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200820132538.24758-2-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-09-07 09:11:30 +02:00
Gustavo A. R. Silva
df561f6688
treewide: Use fallthrough pseudo-keyword
...
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.
[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
2020-08-23 17:36:59 -05:00
Wolfram Sang
d42c9fff1e
mmc: renesas_sdhi: remove manual clk handling
...
The SDHI driver en-/disabled its main clock on its own, e.g. during
probe() and remove(). Now, we leave all handling to RPM.
clk_summary before:
sd0 1 1 0 12480000 0 0 50000
sdif0 2 2 0 12480000 0 0 50000
clk_summary after:
sd0 1 1 0 12480000 0 0 50000
sdif0 1 1 0 12480000 0 0 50000
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be >
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Link: https://lore.kernel.org/r/20200519164251.5430-1-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be >
2020-05-28 11:22:15 +02:00
Ulf Hansson
63fd8ef394
mmc: tmio: Make sure the PM domain is 'started' while probing
...
If the tmio device is attached to a genpd (PM domain), that genpd may have
->start|stop() callback assigned to it. To make sure the device is
accessible during ->probe(), genpd's ->start() callback must be invoked,
which is currently managed by tmio_mmc_host_probe(). However, it's likely
that may be too late for some cases, as registers may be read and written
way before that point.
To fix the behaviour, let's move the call to dev_pm_domain_start() from
tmio_mmc_host_probe() into those clients that needs it. From discussions at
linux-mmc mailing list, it turned out that it should be sufficient to do
this for the SDHI renesas variants, hence the call is move to
renesas_sdhi_probe().
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Link: https://lore.kernel.org/r/20200519152445.6922-1-ulf.hansson@linaro.org
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be >
2020-05-28 11:22:15 +02:00
Takeshi Saito
a38c078fea
mmc: renesas_sdhi: Avoid bad TAP in HS400
...
With R-Car Gen3, CRC error occue at the following TAPs.
H3, M3W 1.3, M3N... TAP=2,3,6,7
M3W 3.0 ... TAP=1,3,5,7
(Note: for 4tap SoCs, the numbers get divided by 2)
Do not use these TAPs in HS400, and also don't use auto correction but
manual correction.
We check for bad taps in two places:
1) After tuning HS400: Then, we select a neighbouring TAP. One of them
must be good, because there are never three bad taps in a row.
Retuning won't help because we just finished tuning.
2) After a manual correction request: Here, we can't switch to the
requested TAP. But we can retune (if the HS200 tuning was good)
because the environment might have changed since the last tuning.
If not, we stay on the same TAP.
Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com >
[wsa: refactored to match upstream driver, reworded commit msg]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200423130432.9990-3-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-05-28 11:21:02 +02:00
Wolfram Sang
f583da4013
mmc: renesas_sdhi: handle M3-W ES1.2 and 1.3 revisions
...
For ES1.2, add a comment explaining the situation. For ES1.3 (and
later, although unlikely), add a new entry defining it as 4tap.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200423130432.9990-2-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-05-28 11:21:02 +02:00
Wolfram Sang
74f6bdb864
mmc: renesas_sdhi: shorten types after refactorization
...
After TAP refactorization, we can use 'unsigned int' for two more
variables because all the calculations work on this type now.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Link: https://lore.kernel.org/r/20200420170230.9091-1-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-05-28 11:21:00 +02:00
Marek Vasut
9cbe0fc8cd
mmc: host: Prepare host drivers for mmc_regulator_set_vqmmc() returning > 0
...
Patch all drivers which use mmc_regulator_set_vqmmc() and prepare them for
the fact that mmc_regulator_set_vqmmc() can return a value > 0, which would
happen if the signal voltage switch did NOT happen, because the voltage was
already set correctly.
Signed-off-by: Marek Vasut <marex@denx.de >
Link: https://lore.kernel.org/r/20200416163649.336967-1-marex@denx.de
[Ulf: Re-worked/simplified the code a bit]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-05-28 11:20:58 +02:00
Wolfram Sang
bcf89cb8e0
mmc: renesas_sdhi: simplify summary output
...
No need to call platform_get_resource twice when we still have the
pointer from before. Also, use '%pa' for a resource_size_t pointer.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Link: https://lore.kernel.org/r/20200408142252.21958-1-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
2020-05-28 11:20:58 +02:00
Wolfram Sang
5fb6bf51f6
mmc: renesas_sdhi: improve TAP selection if all TAPs are good
...
When tuning HS400, if all TAPS are good, we can utilize the SMPCMP
register to select the optimal TAP. For that, we populate a second
bitmap with SMPCMP results and query it in case the regular bitmap is
full (= all good).
Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com >
Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com >
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200408094638.10375-4-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-05-28 11:20:57 +02:00
Wolfram Sang
ec4fc1acf3
mmc: renesas_sdhi: clarify handling of selecting TAPs
...
The comment and the define about how TAPs are selected were confusing to
me because the good TAP was only valid if it was bigger than a *_MAX_*
value. Rename the define and adapt the comment to what really happens.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200408094638.10375-3-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-05-28 11:20:57 +02:00
Wolfram Sang
92fa2a567d
mmc: renesas_sdhi: refactor calculation of best TAP
...
To select the best TAP, we need to find the longest stream of set bits
in a bit field. There is now a helper function for bitmaps which
iterates over all region of set bits. Using it makes the code much more
concise and easier to understand. Double so, because we need to handle
two bitmaps in the near future. Remove a superfluous comment while here.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200408094638.10375-2-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-05-28 11:20:57 +02:00
Wolfram Sang
a5d90dc488
mmc: renesas_sdhi: simplify execute_tuning
...
After refactoring, 'ret' variable is superfluous. Remove it.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Link: https://lore.kernel.org/r/20200213163715.8212-1-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:39:52 +01:00
Wolfram Sang
f22084b662
mmc: tmio: remove superfluous callback wrappers
...
After various refactoring, we can populate the mmc_ops callbacks
directly and don't need to have wrappers for them anymore.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200129203709.30493-7-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Wolfram Sang
b2dd9a1325
mmc: tmio: factor out TAP usage
...
TAPs are Renesas SDHI specific. Now that we moved all handling to the
SDHI core, we can also move the definitions from the TMIO struct to the
SDHI one.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200129203709.30493-6-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Wolfram Sang
a86bf70b70
mmc: tmio: enforce retune after runtime suspend
...
Currently, select_tuning() is called after RPM resume. But
select_tuning() needs some additional function calls to work correctly.
Instead of reimplementing the whole postprocessing, just enforce
retuning.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200129203709.30493-5-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Wolfram Sang
64982b9f2f
mmc: tmio: give callback a generic name
...
check_scc_error() is too Renesas specific. Let's just call it
check_retune() to make it also easier understandable what it does.
Only a rename, no functional change.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200129203709.30493-4-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Wolfram Sang
3a821a8244
mmc: renesas_sdhi: complain loudly if driver needs update
...
When the tap array in the driver is too low, this is not a warning but
an error. Also _once is not helpful, we should make sure it is
prominently in the logs. It is safe to do this because this will only
show up during SoC enablement when we a new SoCs needs more taps (if
that ever will happen).
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200129203709.30493-3-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Wolfram Sang
0c482d829a
mmc: tmio: refactor tuning execution into SDHI driver
...
Move Renesas specific code for executing the tuning with a SCC into the
SDHI driver and leave only a generic call in the TMIO driver. Simplify
the code a little by removing init_tuning() and prepare_tuning()
callbacks. The latter is directly folded into the new execute_tuning()
callbacks.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20200129203709.30493-2-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Wolfram Sang
6199a10e7e
mmc: renesas_sdhi: cleanup SCC defines
...
Use increasing BIT numbers consistently and remove some superfluous
comments.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20191217114034.13290-6-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Wolfram Sang
9b0d6855e7
mmc: renesas_sdhi: enforce manual correction for Gen3
...
HW engineers say that automatic tap correction cannot be used for HS400
in all R-Car Gen3 SoCs. So, check for that SDHI variant and disable it
when HS400 is about to be enabled.
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Link: https://lore.kernel.org/r/20191217114034.13290-5-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Takeshi Saito
71cfc92751
mmc: renesas_sdhi: only check CMD status for HS400 manual correction
...
R-Car Gen3 cannot use correction error status with HS400.
HS200: CMD and DAT signal timing are based on CLK signal.
HS400: CMD signal is based on CLK. DAT signal is based on DS signal.
In HS400, CMD signal is 200MHz(SDR). DAT signal is 200MHz(DDR).
Center position of signal is different between CMD and DAT.
TAP position should be adjusted to the center position of CMD signal.
DAT sampling timing is adjusted by HS400 calibration circuit regardless
of TAP position. Refer to renesas_sdhi_adjust_hs400mode_enable().
However, correction error status contains CMD and DAT status in HS400
(DAT signal is not masked in HS400). Therefore, correction error status
cannot use in HS400. It means that auto correction cannot be uses in
HS400. Manual correction can change to the correct TAP position by
ignoring DAT correction error status and using only CMD correction
status.
Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com >
[wsa: refactored patch from BSP]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20191217114034.13290-4-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Takeshi Saito
11a219606a
mmc: renesas_sdhi: Add manual correction
...
This patch adds a manual correction mechanism for SDHI. Currently, SDHI
uses automatic TAP position correction. However, TAP position can also
be corrected manually via correction error status flags.
Signed-off-by: Takeshi Saito <takeshi.saito.xv@renesas.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Link: https://lore.kernel.org/r/20191217114034.13290-3-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Wolfram Sang
44f54e7012
mmc: renesas_sdhi: remove double clear of automatic correction
...
hw_reset() clears the automatic correction bit twice. I couldn't find
anything in the docs recommending that. Removing one of them didn't
cause any regressions here, so keep it simple.
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Link: https://lore.kernel.org/r/20191217114034.13290-2-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2020-03-24 14:35:38 +01:00
Wolfram Sang
c1a49782cc
mmc: renesas_sdhi: use recent tap values for HS400
...
New datasheets require different and new values for HS400 with 4taps or
8taps.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20191203200513.1758-6-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-12-16 12:29:36 +01:00
Wolfram Sang
12e3c55d23
mmc: renesas_sdhi: remove 4taps as a TMIO flag
...
Now that the quirks structure is accessible, we can remove the TMIO flag
for HS400 using only 4 taps. This is Renesas specific anyhow.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20191203200513.1758-5-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-12-16 12:29:36 +01:00
Wolfram Sang
7af08206cb
mmc: renesas_sdhi: make quirks info accessible outside probe()
...
We will need that for a later patch.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20191203200513.1758-4-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-12-16 12:29:36 +01:00
Wolfram Sang
e5088f20ed
mmc: renesas_sdhi: make warning more precise
...
The warning is not solely used for SDR104 anymore, but for all which
require tuning.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20191203200513.1758-3-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-12-16 12:29:36 +01:00
Wolfram Sang
6e3cbb050b
mmc: renesas_sdhi: keep sorting for quirk entries
...
The two devices next to each other are super similar, but still, let's
keep the alphanumeric sorting for easier additions later.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Link: https://lore.kernel.org/r/20191203200513.1758-2-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-12-16 12:29:36 +01:00
Geert Uytterhoeven
e8307ec51e
mmc: renesas_sdhi: Do not use platform_get_irq() to count interrupts
...
As platform_get_irq() now prints an error when the interrupt does not
exist, counting interrupts by looping until failure causes the printing
of scary messages like:
renesas_sdhi_internal_dmac ee140000.sd: IRQ index 1 not found
Fix this by using the platform_irq_count() helper to avoid touching
non-existent interrupts.
Fixes: 7723f4c5ec ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be >
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-10-03 11:36:22 +02:00
Ulf Hansson
b461197967
Merge branch 'fixes' into next
2019-09-13 13:57:37 +02:00
Ulf Hansson
8861474a10
Revert "mmc: tmio: move runtime PM enablement to the driver implementations"
...
This reverts commit 7ff2131933 .
It turns out that the above commit introduces other problems. For example,
calling pm_runtime_set_active() must not be done prior calling
pm_runtime_enable() as that makes it fail. This leads to additional
problems, such as clock enables being wrongly balanced.
Rather than fixing the problem on top, let's start over by doing a revert.
Fixes: 7ff2131933 ("mmc: tmio: move runtime PM enablement to the driver implementations")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org >
2019-09-13 13:48:35 +02:00
Tamás Szűcs
75eaf49f5d
mmc: sdhi: fill in actual_clock
...
Save set clock in mmc_host actual_clock enabling exporting it via debugfs.
This will indicate the precise SD clock in I/O settings rather than only the
sometimes misleading requested clock.
Signed-off-by: Tamás Szűcs <tszucs@protonmail.ch >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-09-11 15:58:39 +02:00
Wolfram Sang
ef4a8d90b7
mmc: sdhi: remove unneeded initialization
...
Bools are initialized to 'false' by default.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-06-10 17:13:25 +02:00
Wolfram Sang
6a6869869a
mmc: sdhi: improve quirk descriptions
...
Quirks show up in new SoCs as well, so the naming should be generic.
Describe them by what they do.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-06-10 17:12:34 +02:00
Ulf Hansson
07649d9550
Merge branch 'fixes' into next
2019-06-10 17:12:20 +02:00
Niklas Söderlund
7ff2131933
mmc: tmio: move runtime PM enablement to the driver implementations
...
Both the Renesas and Uniphier implementations perform actions which
affect runtime PM before calling into the core tmio_mmc_host_probe()
which enabled runtime PM. Move pm_runtime_enable() from the core and
tmio_mmc_host_probe() into each drivers probe() so it can be called
before any clocks or other resources are switched on.
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be >
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-06-10 17:09:56 +02:00
Wolfram Sang
97bf85b6ec
mmc: sdhi: disallow HS400 for M3-W ES1.2, RZ/G2M, and V3H
...
Our HW engineers informed us that HS400 is not working on these SoC
revisions.
Fixes: 0f4e2054c9 ("mmc: renesas_sdhi: disable HS400 on H3 ES1.x and M3-W ES1.[012]")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Reviewed-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-06-10 17:08:20 +02:00
Wolfram Sang
91ecbe50b6
mmc: renesas_sdhi: set CBSY flag before probing TMIO host
...
The CBSY flag should be proper before calling tmio_mmc_host_probe()
because this function will already use write16 which checks this bit.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Simon Horman <horms+renesas@verge.net.au >
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se >
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-04-15 11:55:54 +02:00
Wolfram Sang
f49bdcde0a
mmc: renesas_sdhi: update copyright information
...
Mostly year updates, but one addition as well.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Simon Horman <horms+renesas@verge.net.au >
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se >
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-04-15 11:55:54 +02:00
Wolfram Sang
c9a9497cce
mmc: renesas_sdhi: limit block count to 16 bit for old revisions
...
R-Car Gen2 has two different SDHI incarnations in the same chip. The
older one does not support the recently introduced 32 bit register
access to the block count register. Make sure we use this feature only
after the first known version.
Thanks to the Renesas Testing team for this bug report!
Fixes: 5603731a15 ("mmc: tmio: fix access width of Block Count Register")
Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com >
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com >
Reviewed-by: Simon Horman <horms+renesas@verge.net.au >
Tested-by: Phong Hoang <phong.hoang.wz@renesas.com >
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org >
2019-03-21 11:41:46 +01:00