From patchwork Wed Mar 7 13:20:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 130883 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp5175486lja; Wed, 7 Mar 2018 05:21:27 -0800 (PST) X-Google-Smtp-Source: AG47ELtfo7bcVd81EF+cGpnF8Ps9SJnlcr6lQOg9iOtrz4W5FpyJKIPy/MnmI6YfrB8XWOB4moNX X-Received: by 2002:a17:902:c24:: with SMTP id 33-v6mr20393320pls.24.1520428887814; Wed, 07 Mar 2018 05:21:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520428887; cv=none; d=google.com; s=arc-20160816; b=0SgtdwToY6Wgn11xYUYEnFQzvltNRv9M2mEmxvEdvU7CgQRGWJBhXrqNNcKoYH+U2m fibGXK4zxTOnl1Jmpue0dUVF1qyfQk3e/ypX+F/6N8fU4VgJKBuFNj7E9Ct2XpJRgTc+ LkcmHpFDNnCcOEYq7TmqyGQZgLBn7fwonX08Gk4oGLeSDfXxg91rU0AvGQWAMHHTvzPF kNZt8BGHWyKdybZgx9QAUa0EmWst4xsidvifmKMsHM+/CWmvvtVWpwAu+9mmMFHIUHsP 7n5kNuIazBh+H3BJ5EHfPyfVmYIqzAevD6SDmJC+ZbYPd14wBK7Vc+8qFBK0+zZKon8S eYzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=wWl3maqSxVfS6QoGcN1BkpwI6y4eqleXnPCCyLmL2lw=; b=gWsLwAaXyBrznqkCpurh14exjEHbrJ6V+uX3PqmePwJ2I8clAyMH2I0BuMBeBT8QGc I9LVyutcgegPqJtcx5gBXqOIl7pg45kSrnbQj90umTCVuLCk0ziERKt/Xz5wHWALrNjF nTfm9gQBXqmMrpMz5vPYOZQEM7IJqkd9qIjmfeEqDlCwlPJPNB/gmmKhlbovapUKAu54 eCtgEe1RejVZmIG2kkav/J86CWrc1fWYW89R3LcXmNEEqzlLwnR1GyeKWtZHE+HrRDVC a/ollrdtR2fc9EVatEvRNYRLxk4UuPdsz4b3FMGBsenTIvTxcrAaUJ5KwGSSAI7uLFQY 4ajg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=GxDMLjbf; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=QUARANTINE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si11362863pgd.787.2018.03.07.05.21.27; Wed, 07 Mar 2018 05:21:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=GxDMLjbf; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=QUARANTINE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754352AbeCGNVY (ORCPT + 5 others); Wed, 7 Mar 2018 08:21:24 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:62584 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754480AbeCGNVT (ORCPT ); Wed, 7 Mar 2018 08:21:19 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w27DKiX1004059; Wed, 7 Mar 2018 07:20:44 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1520428844; bh=nnPNnmUxSzb0AkBwDVZFXBCd2t0CmQ9FI7fvcZygPfs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=GxDMLjbfWfI/FgaCxjuSUPLg+WQhmWbN9qjpFgwyPRSy9zvf7Zh8BgQlhvLdCjE4f ITCctlywYhBY8VqzQ+hmtm77X7x47jc9WMWxexzXCh/gXCet9Q+Zi0TD5oSqcVQdsb 95uf/+rL1UB0iBmrHmDmmw4IeIY3ry+vRgyK4v68= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w27DKi3N015827; Wed, 7 Mar 2018 07:20:44 -0600 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 7 Mar 2018 07:20:44 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 7 Mar 2018 07:20:44 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w27DKMnN018331; Wed, 7 Mar 2018 07:20:39 -0600 From: Kishon Vijay Abraham I To: Ulf Hansson , Tony Lindgren , Adrian Hunter CC: Rob Herring , Mark Rutland , Russell King , , , , , , Subject: [PATCH v3 03/11] mmc: sdhci-omap: Workaround for Errata i843 Date: Wed, 7 Mar 2018 18:50:12 +0530 Message-ID: <20180307132020.30951-4-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180307132020.30951-1-kishon@ti.com> References: <20180307132020.30951-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Errata i843 in AM572x Sitara Processors Silicon Revision 2.0, 1.1 (SPRZ429K July 2014–Revised March 2017 [1]) mentions PG 1.0/1.1 silicon has limitations w.r.t frequencies at which MMC1/2/3 can operate. Use soc_device_match() to identify rev 1.0/1.1 silicon and override mmc->f_max according to the errata workaround. "max-frequency" dt property cannot be used since the device tree is added for rev 2.0 silicon. soc_device_match() is also used in order to get the IODelay values for rev 1.0/1.1 silicon. [1] -> http://www.ti.com/lit/er/sprz429k/sprz429k.pdf Signed-off-by: Kishon Vijay Abraham I --- drivers/mmc/host/sdhci-omap.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 0c40b13fb67d..fbc20a4fbb23 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "sdhci-pltfm.h" @@ -100,6 +101,7 @@ struct sdhci_omap_data { }; struct sdhci_omap_host { + char *version; void __iomem *base; struct device *dev; struct regulator *pbias; @@ -733,12 +735,21 @@ static struct pinctrl_state u32 *caps, u32 capmask) { struct device *dev = omap_host->dev; + char *version = omap_host->version; struct pinctrl_state *pinctrl_state = ERR_PTR(-ENODEV); + char str[20]; if (!(*caps & capmask)) goto ret; - pinctrl_state = pinctrl_lookup_state(omap_host->pinctrl, mode); + if (version) { + snprintf(str, 20, "%s-%s", mode, version); + pinctrl_state = pinctrl_lookup_state(omap_host->pinctrl, str); + } + + if (IS_ERR(pinctrl_state)) + pinctrl_state = pinctrl_lookup_state(omap_host->pinctrl, mode); + if (IS_ERR(pinctrl_state)) { dev_err(dev, "no pinctrl state for %s mode", mode); *caps &= ~capmask; @@ -830,6 +841,16 @@ static int sdhci_omap_config_iodelay_pinctrl_state(struct sdhci_omap_host return 0; } +static const struct soc_device_attribute sdhci_omap_soc_devices[] = { + { + .machine = "DRA7[45]*", + .revision = "ES1.[01]", + }, + { + /* sentinel */ + } +}; + static int sdhci_omap_probe(struct platform_device *pdev) { int ret; @@ -841,6 +862,7 @@ static int sdhci_omap_probe(struct platform_device *pdev) struct mmc_host *mmc; const struct of_device_id *match; struct sdhci_omap_data *data; + const struct soc_device_attribute *soc; match = of_match_device(omap_sdhci_match, dev); if (!match) @@ -875,6 +897,17 @@ static int sdhci_omap_probe(struct platform_device *pdev) if (ret) goto err_pltfm_free; + soc = soc_device_match(sdhci_omap_soc_devices); + if (soc) { + omap_host->version = "rev11"; + if (!strcmp(dev_name(dev), "4809c000.mmc")) + mmc->f_max = 96000000; + if (!strcmp(dev_name(dev), "480b4000.mmc")) + mmc->f_max = 48000000; + if (!strcmp(dev_name(dev), "480ad000.mmc")) + mmc->f_max = 48000000; + } + pltfm_host->clk = devm_clk_get(dev, "fck"); if (IS_ERR(pltfm_host->clk)) { ret = PTR_ERR(pltfm_host->clk);