From patchwork Fri May 15 14:04:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 186829 Delivered-To: patches@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp468411ilb; Fri, 15 May 2020 07:05:04 -0700 (PDT) X-Received: by 2002:ac2:5602:: with SMTP id v2mr2563653lfd.52.1589551503960; Fri, 15 May 2020 07:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589551503; cv=none; d=google.com; s=arc-20160816; b=moXnuySbx56cJdQz9Kmk14hc4fglSlougDZu5DOpTRI2jFfr/3L1p+uWN2Qc/UV+GX dOOoZ2i36NfhI24xpDz4YnZCVUPfpfsAhv3at84sPgnQ51ius1tZka7HvJRU3Uw4HbmB fmv8H+KaJ278Q/qQkAGFTPYC4qS5e7+VmHiOJc+1allIcjNWpPT7Q3Hq69ZhMAG2UIYj pFJjboCsSBQyOhkZ31sMa2nUp41U6FZUQoLcMmMfGGA5Z8Kzgqh/k/YaKoziDXk7Jzng 0H+a1OhLNrGNJLJON35mXUo49zld0ulYndoUNaD7B/xqDBb02sYSk+AGd1VqP+NDdrH5 2kBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=3GzyY6WF9cs2u61XpsJ0RBx3TP+MAWkbmz9R2Rpnmb4=; b=YHgl71DZeyx7IuJgkBqyuSYDxSGHcU5QHtZEwFokX6ciByZKoLpwaGzPnYcLeHlnv8 Je8T/Uc9pOEgbBvULY0e3EemjiRZuXKXC//0iPMV0Mdom5y3/BXPJTNZNYV65Snv+CVI wwXxwB0lN7eHGfYWMxjrewi+0knFrSOGV67yPbWXy95OaCYjfsrjJUQtMx4Xi9Ul9IvY kCoM3T+pQYjDwnF8zWj0qs/j4rvOV/Xn9B1Edl96ErLNGhTbJhFemuHp9PM/1v1D6Cvy OC8H/E7YsCOdLcJvZ8WNQ7C7O4BqojvZoy1GH7TMHlj51lXgmzlqbeC4G4kSbeYN1bRi Es9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IUbSTSGb; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u11sor885573lff.3.2020.05.15.07.05.03 for (Google Transport Security); Fri, 15 May 2020 07:05:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IUbSTSGb; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3GzyY6WF9cs2u61XpsJ0RBx3TP+MAWkbmz9R2Rpnmb4=; b=IUbSTSGbU5dgDcc68w5rzBkq2MbwX4kc+b4wKOLvVfOmlusCGZupExcjkmQjTs08VH sRAYify3Q1e1HPrYGgwTb+rhpwrOxNthoebR9id41DXMuOR6luKAeVeXTxzozlCtklJ2 TFH1Mxt4Roe+x43VJ1NjeSfrFkd99A3KEG6RrhVRWSQ/OO+xavR8eos5c5B/uzsFc5nJ ZAvbEN0EMS/vFRC5U78OE7//vC13/aYQhluBl7dhmxTeoYR4FJoTmsPgaPQdkra/FK6p IR+VLGBOm87vBLzTbSBagYN2QxkU2Xay/oofi73dlX1BcOsm0KcU7S+W2zzEfyLOps90 lg1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3GzyY6WF9cs2u61XpsJ0RBx3TP+MAWkbmz9R2Rpnmb4=; b=j1PyR3u2YpSjeVp4K/cQw5VfwGKm/EOwlT+2+QhH5qQLUoGT5AHPl1s5K4mQdxWyPm YVRQsP/31T3dQN9ICYnqXHQN0OeK5ol3RTxLL6rasmAnR43q8flADMpkcs3ycB0XiJWH qj/oWoXAwcDlPvlY169dVX5w7ctU2ZaFdDA8uX1uhjxFzZiefhT9drLasIuPiaKTv2Sv uxocn5qtnOz6kDFTPSoElZhJJ/l9LGGQ6GBOqZXdPNjVMNeCedlssNf54s6uxcESjUkG 9zNS/CCQA+rIdSat1ezyRq+47mT8Fz/Zu+N+DcAd1hbGsg9XEPxpBnACc1s3gsNC9EC1 ubmg== X-Gm-Message-State: AOAM531cxBeqsXLj5S8PPqIHtidScfFl0LPWWZUxnpij81bze7Ili6OB 3fpzOGuo5k7E5nSFgtdp4AXp4X0p X-Google-Smtp-Source: ABdhPJxYajFmUZMHGZ0pkAdK7BrEi0qf+HcyWTIQjBXReYt07Yt9Nq0E0mP1Z1Rj+z0rel7UpT7u0g== X-Received: by 2002:a19:b8d:: with SMTP id 135mr2517398lfl.145.1589551503534; Fri, 15 May 2020 07:05:03 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-181-7.NA.cust.bahnhof.se. [98.128.181.7]) by smtp.gmail.com with ESMTPSA id s27sm1220215ljo.80.2020.05.15.07.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 07:05:02 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Masahiro Yamada , Wolfram Sang Cc: Ulrich Hecht , Simon Horman , Niklas Soderlund , Geert Uytterhoeven Subject: [PATCH 2/2] mmc: tmio: Make sure the PM domain is 'started' while probing Date: Fri, 15 May 2020 16:04:59 +0200 Message-Id: <20200515140459.15273-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 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(). This is very likely to be too late for some cases, as registers may be read and written way before that. To fix this behaviour, let's drop the call to dev_pm_domain_start() from tmio_mmc_host_probe() - and let the tmio clients manage this instead. Signed-off-by: Ulf Hansson --- drivers/mmc/host/renesas_sdhi_core.c | 3 +++ drivers/mmc/host/tmio_mmc.c | 3 +++ drivers/mmc/host/tmio_mmc_core.c | 2 -- drivers/mmc/host/uniphier-sd.c | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index ff72b381a6b3..5d44240d57ec 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -909,6 +910,8 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (ret) goto efree; + dev_pm_domain_start(&pdev->dev); + ver = sd_ctrl_read16(host, CTL_VERSION); /* GEN2_SDR104 is first known SDHI to use 32bit block count */ if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX) diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index 93e83ad25976..b8f5687e10be 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "tmio_mmc.h" @@ -172,6 +173,8 @@ static int tmio_mmc_probe(struct platform_device *pdev) host->mmc->f_max = pdata->hclk; host->mmc->f_min = pdata->hclk / 512; + dev_pm_domain_start(&pdev->dev); + ret = tmio_mmc_host_probe(host); if (ret) goto host_free; diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index ba301fb7656b..d7fde57c78c1 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -1192,7 +1191,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) /* See if we also get DMA */ tmio_mmc_request_dma(_host, pdata); - dev_pm_domain_start(&pdev->dev); pm_runtime_get_noresume(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_set_autosuspend_delay(&pdev->dev, 50); diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c index f82baf99fd69..0c41dc1cc96c 100644 --- a/drivers/mmc/host/uniphier-sd.c +++ b/drivers/mmc/host/uniphier-sd.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "tmio_mmc.h" @@ -624,6 +625,8 @@ static int uniphier_sd_probe(struct platform_device *pdev) if (ret) goto free_host; + dev_pm_domain_start(dev); + uniphier_sd_host_init(host); tmio_data->ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34;