From patchwork Fri Apr 27 11:47: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: 134586 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp617441lji; Fri, 27 Apr 2018 04:47:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpN2dGS48v45FycKjd6JezSdVNptqVqF4My6j54XuWdbwIqCgMouRB58/gz3Fj6KQYhqx+Y X-Received: by 2002:a17:902:8ec4:: with SMTP id x4-v6mr2005583plo.370.1524829670870; Fri, 27 Apr 2018 04:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524829670; cv=none; d=google.com; s=arc-20160816; b=YUMCuQ4OvdhJQc60/hJ0LZYPOCitJHl+y68up5QkeqKN2DZ4roEuAVl1kL3GUB2zvB fwGn+Aq8DzlyMIHCJ/1gEBF43ZxeKm91i4sHpqhEIt9XThDdBWejbCvAC15MQ9g0Sc7w KX/uPfS2fKgBawaRFOpcR9o1VqndVDuU8AhN8dhAXyiV3J9USFX8tsqjyTIL0zL097AK s3hm1tCmatBxFDXyz3kyg1ps6Vi1esAhZqb7Y8wb+GoRYcD3bxQmLLnm9jIhMoLMbgV2 KAmIM5Q59bYdS8I2ChNuukPebpyrnysN5AGkj7tONqldGG7Jfc5zQNKu5nhlDnF3iDoU yLBQ== 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=IghhexPMLh+MvvMySoxllQZcK+gFYmc+/KBWR2hvIqY=; b=eh4Bqx3eiiZIg2CsAD424K4qmaRAz6GmjUpMwXhze0BXT4ilCNeBuWS1GaCR/HnYBA ckCCpSrdtfOuvU3jwqFqox1zsSTn4cJcaPhSNUmkSa5QVviu7vj5gDAeKw0eceIQCmPa ywatSPqGAETyfMgS74aJptSZXBqMo6w5FvzechgEys9n6IYbzKqGeykjVZucbNQlygYC MSYyp0ZIB0AaH3uFjygO6bmkWAhsI+QUcT4CKhz8pFz6QTHHCC9j09jzWYuyUNWFTla7 pgzRwafgi2+c0YJUN7zrIdTKVwqeOIuMjc7Nz7/KDJf27EP6/27SX3DhOqWpu8YN0jDA UQew== 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=b/y69oFd; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 e2si1172813pfm.220.2018.04.27.04.47.50; Fri, 27 Apr 2018 04:47:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=b/y69oFd; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 S1757704AbeD0Lrs (ORCPT + 6 others); Fri, 27 Apr 2018 07:47:48 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:48807 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758002AbeD0Lrp (ORCPT ); Fri, 27 Apr 2018 07:47:45 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3RBleMs026207; Fri, 27 Apr 2018 06:47:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524829660; bh=1DgvGqliqEtndAXzto+TEDn8+jvjWYQ+fGgP7bvn/Qg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=b/y69oFdx1JGVypB4fzns7ZTQ5lCxGu9W3gVCcYulshg1q8Q03f1KK8mvXYlaa73Z BmJUTn00dHVEhHj2DWa3KdyV2O9cS64O5r0xkUKeYScCOugxaOgljf5P5tqqMYZBh3 lhJQlWceHlNWBOF9sqEEnbrNnF41DE5ggDNwUzgY= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3RBldl2014791; Fri, 27 Apr 2018 06:47:39 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 27 Apr 2018 06:47:40 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 27 Apr 2018 06:47:39 -0500 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 w3RBlRSH014207; Fri, 27 Apr 2018 06:47:37 -0500 From: Kishon Vijay Abraham I To: Ulf Hansson , Adrian Hunter CC: Rob Herring , Mark Rutland , , , , , Subject: [PATCH v5 03/14] mmc: sdhci-omap: Workaround for Errata i843 Date: Fri, 27 Apr 2018 17:17:12 +0530 Message-ID: <20180427114723.2687-4-kishon@ti.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427114723.2687-1-kishon@ti.com> References: <20180427114723.2687-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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 Acked-by: Adrian Hunter Acked-by: Tony Lindgren --- drivers/mmc/host/sdhci-omap.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" 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 78f3ceea570e..b3dc7f1466e5 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);