From patchwork Mon Dec 2 14:41:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 180610 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp43853ile; Mon, 2 Dec 2019 06:41:31 -0800 (PST) X-Google-Smtp-Source: APXvYqym6lT4k+5K/k3Dc2eTs92aQbIDFTi+erJ3BVi2GR4iFSx5lj9Pfrw6MCYcsFfKGZf3zI4A X-Received: by 2002:a1c:486:: with SMTP id 128mr25330172wme.163.1575297691559; Mon, 02 Dec 2019 06:41:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575297691; cv=none; d=google.com; s=arc-20160816; b=dnEf0G/gB3jZOBhIt3AXZDOzQ9/QntA4xlPSZU0LTWgGS/g1o7ls1zOwhlyI+4KiF+ qAkvUwVquXYTiZN+ivxs/F3WebOeulfBP5prX5mO+HXkAspUsxFjsWWr8DLtgJeun0US HrE39YrVOEKTU8zZdcN3rEcZUDil9gTuUwQnqRmjid+viAmjrRcluqeFobR8XcQcOfFW n4ZDdK5ets22bVElGWdHqmKY2+0WnwT2IbTm4cgFlkyBiEoVKppVoZ/50bGrW4EeHkBo zBUEyQT0CjPt3q5Bp+lpMOAnpaOaPg7IXYzWfKvIcXxuAaZQE18e1Qm3J4GR2HV9XCcF p13w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=4JVaie1wKwbF/eE0x2jamXEgMwRcra2vbyk9yLgEYR8=; b=epMLC9gt1dTNu7oDsc83scplM8uGqTcPwGpEZopHDp8C0RELR35pDDeurfv1OpPfI4 DavOGVHUwNOFLZiLq/zwqJoy984VFnaNRr+RxAYe5dpZmrpQY2Vt4Q9ASGC/XDCr1sbB XxF601jVxUY1n1r4qhCdsQOzRyPWknHrY6oAcCIhnBEIGw3Jaf/DmL6VddwcoTwTQjQT 7YpBkuJO9LEgaiFSCT0DCOmILRuEyiD8RPH80+Qvd3OQR/7FB1cV06sYwdLnxBWk3AUq 8RZ+NfOJv/lVDuUlI38G0m8qmMVn4RPJvjYI+hEeosI7loyd8iYOizax+3QFGyop7LbS H08g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pwVHpEcI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2si9723359edn.314.2019.12.02.06.41.31; Mon, 02 Dec 2019 06:41:31 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=pwVHpEcI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727598AbfLBOlb (ORCPT + 8 others); Mon, 2 Dec 2019 09:41:31 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42675 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727362AbfLBOla (ORCPT ); Mon, 2 Dec 2019 09:41:30 -0500 Received: by mail-pf1-f196.google.com with SMTP id l22so6105815pff.9 for ; Mon, 02 Dec 2019 06:41:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=4JVaie1wKwbF/eE0x2jamXEgMwRcra2vbyk9yLgEYR8=; b=pwVHpEcIT1sHACwQ7+9kcf6Yne/nC43A86UnrCMyRq0S24voaGFsqBhlNu5dBu22On nPOO55SKDBil+llsZXpyhXgfwkjSs62UROY5fDd8IJzyNetr25/gUfzQt5XiJlMjo4oy m6iy82qxO6Ke00Sky8rtJ6LPBJr5PMWWflvNDxJ61qX6PIfcPauWgit9Gy/XrnDwLrnc YstZP9Pxe5ghWbsujegWn8KzcNMp2JHEnOj+UhMDPFQU5UMtac7h5EIEHg+c/t9gbvKA +bZVR88ZZLrRQUneB6Z83ZlB6JirYDceWgI3rPBR2yUCyDPMXZfIICL5asvlEqle5ink guvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=4JVaie1wKwbF/eE0x2jamXEgMwRcra2vbyk9yLgEYR8=; b=F12uLx8gko4AZUcnbD9HGn69xUCnxUB2PmjLu/41u1OK+j2tqrc8BPgM1NE5UQNpRJ VjfWx6o5E/nH1tjcXGqr6aewyTxhLT+KqUJLjdA8oYHHcI4Y9XXqCt6SwONS8aSPs/Y7 UVCC91o/Q3BEy/YWc9Zj5++CSdtOE7uhaw+LctxomGw3D1eJ9k5tO5IQXk2eCkJFzs/W Q/eovGR9BD/MtuKC1uxyBVyL+Vh0RrkHl+q51uGIUb37BMvA083ZugOZH/LKaxMWnPvx tZBRCk4bEPA9HkD4W3/jRb5iWKd2IiEQBL6dpny/9r2XJ3dwFjN+er7vpLo8JdyLAqCq 5juA== X-Gm-Message-State: APjAAAUzroM6huO7lxPBJGIOZ3pxVnBAN3jgO3fnoLRrpp/Fuiwfd9Az CACRWurpxtLr9U/ZxC7kM2snqA== X-Received: by 2002:aa7:9f9b:: with SMTP id z27mr24887087pfr.102.1575297690097; Mon, 02 Dec 2019 06:41:30 -0800 (PST) Received: from localhost.localdomain (li519-153.members.linode.com. [66.175.222.153]) by smtp.gmail.com with ESMTPSA id f30sm33985090pga.20.2019.12.02.06.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 06:41:29 -0800 (PST) From: Jun Nie To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, adrian.hunter@intel.com, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 3/4] mmc: sdhci: Set ctrl_hs400 value in dts Date: Mon, 2 Dec 2019 22:41:03 +0800 Message-Id: <20191202144104.5069-4-jun.nie@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191202144104.5069-1-jun.nie@linaro.org> References: <20191202144104.5069-1-jun.nie@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Because ctrl_hs400 value is non-standard, add support to set it in dts. Signed-off-by: Jun Nie --- drivers/mmc/host/sdhci.c | 9 ++++++++- drivers/mmc/host/sdhci.h | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index a654f0aeb438..d8a6c1c91448 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1899,7 +1899,7 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing) (timing == MMC_TIMING_MMC_DDR52)) ctrl_2 |= SDHCI_CTRL_UHS_DDR50; else if (timing == MMC_TIMING_MMC_HS400) - ctrl_2 |= SDHCI_CTRL_HS400; /* Non-standard */ + ctrl_2 |= host->sdhci_ctrl_hs400; /* Non-standard */ sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); } EXPORT_SYMBOL_GPL(sdhci_set_uhs_signaling); @@ -3635,6 +3635,13 @@ void __sdhci_read_caps(struct sdhci_host *host, const u16 *ver, of_property_read_u64(mmc_dev(host->mmc)->of_node, "sdhci-caps", &dt_caps); + if (of_property_read_u32(mmc_dev(host->mmc)->of_node, + "sdhci-ctrl-hs400", &host->sdhci_ctrl_hs400)) + host->sdhci_ctrl_hs400 = SDHCI_CTRL_HS400; + else + WARN_ON(host->sdhci_ctrl_hs400 > 7 + || host->sdhci_ctrl_hs400 < 5); + v = ver ? *ver : sdhci_readw(host, SDHCI_HOST_VERSION); host->version = (v & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 0e6f97eaa796..cac4d819f62c 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -184,7 +184,8 @@ #define SDHCI_CTRL_UHS_SDR50 0x0002 #define SDHCI_CTRL_UHS_SDR104 0x0003 #define SDHCI_CTRL_UHS_DDR50 0x0004 -#define SDHCI_CTRL_HS400 0x0005 /* Non-standard */ +/* SDHCI_CTRL_HS400 is non-standard value, can change it in dts */ +#define SDHCI_CTRL_HS400 0x0005 #define SDHCI_CTRL_VDD_180 0x0008 #define SDHCI_CTRL_DRV_TYPE_MASK 0x0030 #define SDHCI_CTRL_DRV_TYPE_B 0x0000 @@ -605,6 +606,9 @@ struct sdhci_host { u64 data_timeout; + /* SDHCI_CTRL_HS400 value */ + u32 sdhci_ctrl_hs400; + unsigned long private[0] ____cacheline_aligned; };