From patchwork Wed Dec 27 15:13:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Nijnikov X-Patchwork-Id: 10133733 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F27D60388 for ; Wed, 27 Dec 2017 15:16:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 427502C690 for ; Wed, 27 Dec 2017 15:16:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3721B2C6DE; Wed, 27 Dec 2017 15:16:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A09962C690 for ; Wed, 27 Dec 2017 15:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbdL0PQE (ORCPT ); Wed, 27 Dec 2017 10:16:04 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:25841 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751963AbdL0POC (ORCPT ); Wed, 27 Dec 2017 10:14:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1514388647; x=1545924647; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=a4inwEGzDTIwl+unbDHw0yDz2tzBZdgi/wv8X3LwW3k=; b=GoA3FS0WL68lU3cg0JEf8cHeefLBKmpysyvsT9h/DUYoyWqjjwLl8P4d sOOD6AF30Xxr0PvQOPbZ4Mm3BPnXKFaE8AU/aLfeoclBrXeL3PwFlu2Wj LKZdNDBhKWI2XHTBo+qolDA9WFhf10Aoo/Lo/zIDwlES60l+A000DlIOr qLsaulZ5QkB2N+oHSfEiQ6hASgU8CAo05bYz6s3Z0DoVrzejn5tQzhZ58 LCuWIZmc5G3o9KaOULyZecuZDBhRZsBp8+WKadnMLWMPrZ2Mv4VFHN7p8 9Dr0xXFvE7oyIS35hfqX0nQMXv/hoa4YgN3678JedJMQlhADnlMqZKyIc w==; X-IronPort-AV: E=Sophos;i="5.45,466,1508774400"; d="scan'208";a="163084815" Received: from sjappemgw12.hgst.com (HELO sjappemgw11.hgst.com) ([199.255.44.66]) by ob1.hgst.iphmx.com with ESMTP; 27 Dec 2017 23:30:46 +0800 Received: from ilb000042.sdcorp.global.sandisk.com ([10.0.231.79]) by sjappemgw11.hgst.com with ESMTP; 27 Dec 2017 07:14:01 -0800 From: Stanislav Nijnikov To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Cc: alex.lemberg@wdc.com, Stanislav Nijnikov Subject: [PATCH v2 2/9] ufs: sysfs: interconnect descriptor Date: Wed, 27 Dec 2017 17:13:40 +0200 Message-Id: <1514387627-27817-3-git-send-email-stanislav.nijnikov@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514387627-27817-1-git-send-email-stanislav.nijnikov@wdc.com> References: <1514387627-27817-1-git-send-email-stanislav.nijnikov@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces a sysfs group entry for the UFS interconnect descriptor parameters. The group adds "interconnect_descriptor" folder under the UFS driver sysfs entry (/sys/bus/platform/drivers/ufshcd/*). The parameters are shown as hexadecimal numbers. The full information about the parameters could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov Reviewed-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-driver-ufs | 19 +++++++++++++++++++ drivers/scsi/ufs/ufs-sysfs.c | 18 ++++++++++++++++++ drivers/scsi/ufs/ufs.h | 8 ++++++++ 3 files changed, 45 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index da39c63..35a8731 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -221,3 +221,22 @@ Description: This file shows the command maximum timeout for a change parameters. The full information about the descriptor could be found at UFS specifications 2.1. The file is read only. + + +What: /sys/bus/platform/drivers/ufshcd/*/interconnect_descriptor/unipro_version +Date: August 2017 +Contact: Stanislav Nijnikov +Description: This file shows the MIPI UniPro version number in BCD format. + This is one of the UFS interconnect descriptor parameters. + The full information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/interconnect_descriptor/mphy_version +Date: August 2017 +Contact: Stanislav Nijnikov +Description: This file shows the MIPI M-PHY version number in BCD format. + This is one of the UFS interconnect descriptor parameters. + The full information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. \ No newline at end of file diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index 63a8e68..b8e29f2 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -132,8 +132,26 @@ static const struct attribute_group ufs_sysfs_device_descriptor_group = { .attrs = ufs_sysfs_device_descriptor, }; +#define UFS_INTERCONNECT_DESC_PARAM(_name, _uname, _size) \ + UFS_DESC_PARAM(_name, _uname, INTERCONNECT, _size) + +UFS_INTERCONNECT_DESC_PARAM(unipro_version, UNIPRO_VER, WORD); +UFS_INTERCONNECT_DESC_PARAM(mphy_version, MPHY_VER, WORD); + +static struct attribute *ufs_sysfs_interconnect_descriptor[] = { + &dev_attr_unipro_version.attr, + &dev_attr_mphy_version.attr, + NULL, +}; + +static const struct attribute_group ufs_sysfs_interconnect_descriptor_group = { + .name = "interconnect_descriptor", + .attrs = ufs_sysfs_interconnect_descriptor, +}; + static const struct attribute_group *ufs_sysfs_groups[] = { &ufs_sysfs_device_descriptor_group, + &ufs_sysfs_interconnect_descriptor_group, NULL, }; diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index 6ae1e08..773c049 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -230,6 +230,14 @@ enum device_desc_param { DEVICE_DESC_PARAM_PRDCT_REV = 0x2A, }; +/* Interconnect descriptor parameters offsets in bytes*/ +enum interconnect_desc_param { + INTERCONNECT_DESC_PARAM_LEN = 0x0, + INTERCONNECT_DESC_PARAM_TYPE = 0x1, + INTERCONNECT_DESC_PARAM_UNIPRO_VER = 0x2, + INTERCONNECT_DESC_PARAM_MPHY_VER = 0x4, +}; + /* * Logical Unit Write Protect * 00h: LU not write protected