Got it.. Will fix it in next version.code is conditioned on hw designer.(...)
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
+ if (host->hw_designer == AMBA_VENDOR_QCOM) {
+ host->cclk = host->mclk;
+ } else if (desired >= host->mclk) {
Again refrain from hard-checking the vendor everywhere.
struct variant_data {
bool qcom_cclk_is_mclk;
(...)
As per example from st_clkdiv...This looks good.
Then
if (host->vendor->qcom_cclk_is_mclk) {
(...)
}
+ if (ios->clock != host->mclk &&
+ host->hw_designer == AMBA_VENDOR_QCOM) {
+ /* Qcom MCLKCLK register does not define bypass bits */
+ int rc = clk_set_rate(host->clk, ios->clock);
+ if (rc < 0) {
+ dev_err(mmc_dev(host->mmc),
+ "Error setting clock rate (%d)\n", rc);
+ } else {
+ host->mclk = clk_get_rate(host->clk);
+ host->cclk = host->mclk;
+ }
+ }
For this I would define a vendor data like:
struct variant_data {
bool explicit_mclk_control;
(...)
Or something. It explains what is actually going on.
if (plat->f_max)
- mmc->f_max = min(host->mclk, plat->f_max);
+ mmc->f_max = (host->hw_designer == AMBA_VENDOR_QCOM) ?
+ plat->f_max : min(host->mclk, plat->f_max);
So rewrite like that:
if (host->vendor->explicit_mclk_control)
mmc->f_max = plat->f_max;
else
mmc->f_max = min(host->mclk, plat->f_max);
Yours,--
Linus Walleij