From patchwork Tue Sep 1 06:00:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bao D. Nguyen" X-Patchwork-Id: 11747387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F13E1722 for ; Tue, 1 Sep 2020 06:01:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA0FD20FC3 for ; Tue, 1 Sep 2020 06:01:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="kvleLdIX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726764AbgIAGB1 (ORCPT ); Tue, 1 Sep 2020 02:01:27 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:29941 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726212AbgIAGBY (ORCPT ); Tue, 1 Sep 2020 02:01:24 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1598940083; h=References: In-Reply-To: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=AteWpHSbFk1S1IfMSH+QeUOwe9NNI3v5yOM9S0tfHwM=; b=kvleLdIXPRE/lNGKJgOrxyiOjOjyd+DCtrBEu42obqZstSph/BKNpmEWhvFo+vNkWo0HXgeu 1nfAlZSxTbJxSFvpUJ+F/tYdTvszHy6/U/w0txIRvjvxPX0LY4Jjm56GH18bKkwVJPKN2DEU V5R0FrSyqR6AyB9NI1mPe/g5Z+4= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyJlNmU5NiIsICJsaW51eC1zY3NpQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 5f4de39cd7b4e26913631e62 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 01 Sep 2020 06:01:00 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 5C7E3C43387; Tue, 1 Sep 2020 06:01:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nguyenb) by smtp.codeaurora.org (Postfix) with ESMTPSA id 52B43C433CA; Tue, 1 Sep 2020 06:00:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 52B43C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=nguyenb@codeaurora.org From: "Bao D. Nguyen" To: cang@codeaurora.org, asutoshd@codeaurora.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org Cc: "Bao D. Nguyen" , linux-arm-msm@vger.kernel.org, Rob Herring , Bjorn Andersson , Avri Altman , Vinod Koul , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 1/2] scsi: dt-bindings: ufs: Add vcc-voltage-level for UFS Date: Mon, 31 Aug 2020 23:00:47 -0700 Message-Id: <0a9d395dc38433501f9652a9236856d0ac840b77.1598939393.git.nguyenb@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org UFS's specifications supports a range of Vcc operating voltage levels. Add documentation for the UFS's Vcc voltage levels setting. Signed-off-by: Can Guo Signed-off-by: Asutosh Das Signed-off-by: Bao D. Nguyen --- Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt index 415ccdd..7257b32 100644 --- a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +++ b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt @@ -23,6 +23,8 @@ Optional properties: with "phys" attribute, provides phandle to UFS PHY node - vdd-hba-supply : phandle to UFS host controller supply regulator node - vcc-supply : phandle to VCC supply regulator node +- vcc-voltage-level : specifies voltage levels for VCC supply. + Should be specified in pairs (min, max), units uV. - vccq-supply : phandle to VCCQ supply regulator node - vccq2-supply : phandle to VCCQ2 supply regulator node - vcc-supply-1p8 : For embedded UFS devices, valid VCC range is 1.7-1.95V From patchwork Tue Sep 1 06:00:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bao D. Nguyen" X-Patchwork-Id: 11747391 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3B5E13B6 for ; Tue, 1 Sep 2020 06:02:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD78620FC3 for ; Tue, 1 Sep 2020 06:02:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="gbgplMaU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726212AbgIAGC0 (ORCPT ); Tue, 1 Sep 2020 02:02:26 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:22286 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbgIAGCZ (ORCPT ); Tue, 1 Sep 2020 02:02:25 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1598940145; h=References: In-Reply-To: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=JkB5t793pKcL4ZJ57eDDbDImH896a5Jx/bAmj4NC5Vg=; b=gbgplMaUi7YU1jV2cqrHL+Kr04IvoebCkTi2yaOF0VSYInMXHc32fpDfw2w3cEsIliTFoQG3 WZEtMe8iORTWoFehmJHVdInQZWWsqB6fJmq5F/UYI6oPRGczkvH/MZp/khlzx7I/ADDYBWO9 1gwjOXUuqZZJiZQmmwMa/SPUFwY= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJlNmU5NiIsICJsaW51eC1zY3NpQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-east-1.postgun.com with SMTP id 5f4de3a173afa3417e2a8ce6 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 01 Sep 2020 06:01:05 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C3F88C433A0; Tue, 1 Sep 2020 06:01:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nguyenb) by smtp.codeaurora.org (Postfix) with ESMTPSA id A11D1C433CA; Tue, 1 Sep 2020 06:01:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A11D1C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=nguyenb@codeaurora.org From: "Bao D. Nguyen" To: cang@codeaurora.org, asutoshd@codeaurora.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org Cc: "Bao D. Nguyen" , linux-arm-msm@vger.kernel.org, Alim Akhtar , Avri Altman , "James E.J. Bottomley" , YueHaibing , Bean Huo , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 2/2] scsi: ufs: Support reading UFS's Vcc voltage from device tree Date: Mon, 31 Aug 2020 23:00:48 -0700 Message-Id: <69db325a09d5c3fa7fc260db031b1e498b601c25.1598939393.git.nguyenb@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The UFS specifications supports a range of Vcc operating voltage from 2.4-3.6V depending on the device and manufacturers. Allows selecting the UFS Vcc voltage level by setting the UFS's entry vcc-voltage-level in the device tree. If UFS's vcc-voltage-level setting is not found in the device tree, use default values provided by the driver. Signed-off-by: Can Guo Signed-off-by: Asutosh Das Signed-off-by: Bao D. Nguyen --- drivers/scsi/ufs/ufshcd-pltfrm.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 3db0af6..48f429c 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -104,10 +104,11 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) static int ufshcd_populate_vreg(struct device *dev, const char *name, struct ufs_vreg **out_vreg) { - int ret = 0; + int len, ret = 0; char prop_name[MAX_PROP_SIZE]; struct ufs_vreg *vreg = NULL; struct device_node *np = dev->of_node; + const __be32 *prop; if (!np) { dev_err(dev, "%s: non DT initialization\n", __func__); @@ -138,8 +139,16 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, vreg->min_uV = UFS_VREG_VCC_1P8_MIN_UV; vreg->max_uV = UFS_VREG_VCC_1P8_MAX_UV; } else { - vreg->min_uV = UFS_VREG_VCC_MIN_UV; - vreg->max_uV = UFS_VREG_VCC_MAX_UV; + prop = of_get_property(np, "vcc-voltage-level", &len); + if (!prop || (len != (2 * sizeof(__be32)))) { + dev_warn(dev, "%s vcc-voltage-level property.\n", + prop ? "invalid format" : "no"); + vreg->min_uV = UFS_VREG_VCC_MIN_UV; + vreg->max_uV = UFS_VREG_VCC_MAX_UV; + } else { + vreg->min_uV = be32_to_cpup(&prop[0]); + vreg->max_uV = be32_to_cpup(&prop[1]); + } } } else if (!strcmp(name, "vccq")) { vreg->min_uV = UFS_VREG_VCCQ_MIN_UV;