Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4945994rdb; Tue, 12 Dec 2023 14:09:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEl0wP05uAWe41KKlganvByx+DZl9cQCS11fEbq15L7a3h/2vo0fCRGedFPM4yrvJtZs+zt X-Received: by 2002:a17:90b:1487:b0:288:67fb:8930 with SMTP id js7-20020a17090b148700b0028867fb8930mr5369631pjb.29.1702418941449; Tue, 12 Dec 2023 14:09:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702418941; cv=pass; d=google.com; s=arc-20160816; b=eui2QKHpOZFU5h9X3YJ2t73UJ3lo69gCZdtaebD/zEaLc+KiFMel8zCwoCcamTxsKm ALQNtWb0rGM71rA/rK0VBNILbex4e9GMoOeikaORzp/f44vqM5Hi36/QK0Zj1irNBDsz GI0vIGqGlX6/hdXnXzx+E1CSRTGMibeEq3NFMBcn+exiJuXL8JJzzmGGKtkQvFCjgntZ qh02VSvME7BAWJuXS63Wx6Edh2OvBH+tn3Dt6eg2NLBUhsLrXWRLOYetcVunKShGY/OW lWDRGWHDjjyWYYaVeUrytl9Si6DEpKOpnxh18zQqI8GWt8nUZgGO/0Q0mFk3OehqIHKO Ooww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=7Ti5UcywgqFS+9CZzfTbKXKYv/LJc+sEGxe+xBAGoFo=; fh=fdE7wVJMYItyI18vxIdiOxAWmMjXMz0o8GFp037AlGU=; b=ExdbHT2wvMEKF4myB1qGHubQDPtRTRgpyZcaDL5Zf6seMek5PJX4Rt/FkMCO3+7QSg ei+hHFk2EPJNyPiYBg6Bwri6Ykw35oXGB3Ftq/fP98v8Iv6VgIJdPia/M5IKP3lldkYG zfJYOe5azd1+uxP5JRInvhT9BVugYqjx5ai2vAwLZYFdVQSkKkOq8WhVNEUVdtQRJdmS j98IdimGXpgs2ANF/1dS+Jpnp/A6nzuLSV/QR3oClVNapc5j8997k0luer5MUOGqoSAZ 1PNDeWfDnLuMHvKgRY/V3FoKqHXkHefmO3VhGGjGDESzQsfc+uNVsiLkKdITzCdhDl01 cP1w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iokpp.de header.s=strato-dkim-0002 header.b=pqnSL8Fj; dkim=neutral (no key) header.i=@iokpp.de header.s=strato-dkim-0003; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id c19-20020a17090ad91300b002868d17b86esi8486571pjv.107.2023.12.12.14.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 14:09:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@iokpp.de header.s=strato-dkim-0002 header.b=pqnSL8Fj; dkim=neutral (no key) header.i=@iokpp.de header.s=strato-dkim-0003; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A8E0D801C8CC; Tue, 12 Dec 2023 14:08:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377683AbjLLWIm (ORCPT + 99 others); Tue, 12 Dec 2023 17:08:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231690AbjLLWIk (ORCPT ); Tue, 12 Dec 2023 17:08:40 -0500 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B1A8B3; Tue, 12 Dec 2023 14:08:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702418917; cv=none; d=strato.com; s=strato-dkim-0002; b=IaL+LtM/3sr6O7C1Kk7kUq5UUfMeWCAeOz5bfzNSfCDsRSpInihXPzis28eRbPjM8P 9JrqzST3sg8YO9t1qIT6khqoPFxqIENVDj/hv741nRYUnwWMWYinxc0ItWFpa1FL1aIm xCCZU/qMpjxfv/qS3v2Sr1FSihqyMQQSZaXxsEjpP/k51H0iACsMFA58nsFkQfl1zvup PYN34+523OZCzmNWo+56ccj6KSUFqowZV5gtA6akO2rERDMk3c58yo7rNhlBAC45xloQ yIpzFMxfkIaDI1WuOACxNuo6h/khQwCSbG1sY0taiVAcpwi6ssxOJ7y1eiJN6GQc9w1l DoNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1702418917; s=strato-dkim-0002; d=strato.com; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=7Ti5UcywgqFS+9CZzfTbKXKYv/LJc+sEGxe+xBAGoFo=; b=qfLzIDH3oMZhRbuvUDQYzmhq9OU/1l2aBqXjBiZRdXBRfNlKc7KHYcShl99xf6tisT JHepcRlFjgYn+/nAql3zTBd305542Ljhv5NQoa45Q+xOcrJ9wt2GR7wwIZYmR65dpiwK Zi+wZb50f5RTl+N+qncbp6oFYRjpHZlQLq54N59vgOFt2j3IzvZB1h1Us6a1Frt8Wowt dljGHTKk5pFuR307YOiTj8lqWth/oFbGEFqBxrRXCwT3gW1mozfSiRq1+hNqP4hWs0l4 RMVPNqWaBPuZFCN3TY0Jjf1TF5GBZI8IDkpHx39Qk/He1liUJWQFMjXFtDr7KFxp6G7J IQPA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1702418917; s=strato-dkim-0002; d=iokpp.de; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=7Ti5UcywgqFS+9CZzfTbKXKYv/LJc+sEGxe+xBAGoFo=; b=pqnSL8Fj5n3A/v8BqnxaxxW57LiBqBI3IddBFTg+rui2xw9kx9UlEl7bvbbl65jdTb /pfKBBqb3FVMP9t6/bwxlQsVqlRVV33uPHjyroPhy86UqjmzndPZm8Ax3vUdP7srVZbI OcILIAh+VWbR5CDwAmVF63rdIRvdhzNJJfQ3+4SOkSB6n61pflY8HgWqc7Qnj9YEE55S STJBs7xptY9QDJxZk3BW4gQDrLPYiv5YOmqlPCl63bCHTDQhDO45JBBOPCcgOtoQ22eP rvjibwQBik77AgtNmICXK3JJ71LCoHfW8nZwnkdQGC5d5yh4s+8y0WU1bekeDPCo/W17 bbYQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1702418917; s=strato-dkim-0003; d=iokpp.de; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=7Ti5UcywgqFS+9CZzfTbKXKYv/LJc+sEGxe+xBAGoFo=; b=KjzdvV6smK54+DJV1mtGbUIEWgex8tEvdXBsPmoYP9LS4crwXfCv5g9csJuTqVrYVW QEeTRR9UGIo11QtXH4CQ== X-RZG-AUTH: ":LmkFe0i9dN8c2t4QQyGBB/NDXvjDB6pBSedrgBzPc9DUyubU4DD1QLj68UeUr1+U1krW49WPrbTU8waUHk0CK6S5K43N4UTp8lPg" Received: from Munilab01-lab.speedport.ip by smtp.strato.de (RZmta 49.10.0 AUTH) with ESMTPSA id z4c2a6zBCM8aNVy (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 12 Dec 2023 23:08:36 +0100 (CET) From: Bean Huo To: avri.altman@wdc.com, bvanassche@acm.org, alim.akhtar@samsung.com, jejb@linux.ibm.com, martin.petersen@oracle.com, mani@kernel.org, quic_cang@quicinc.com, quic_asutoshd@quicinc.com, beanhuo@micron.com, thomas@t-8ch.de Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, mikebi@micron.com, lporzio@micron.com, Bean Huo Subject: [PATCH v5 0/3] Add UFS RTC support Date: Tue, 12 Dec 2023 23:08:22 +0100 Message-Id: <20231212220825.85255-1-beanhuo@iokpp.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Dec 2023 14:08:57 -0800 (PST) Adding RTC support for embedded storage device UFS in its driver, it is important for a few key reasons: 1. Helps with Regular Maintenance: The RTC provides a basic way to keep track of time, making it useful for scheduling routine maintenance tasks in the storage device. This includes things like making sure data is spread evenly across the storage to extend its life. 2. Figuring Out How Old Data Is: The RTC helps the device estimate how long ago certain parts of the storage were last used. This is handy for deciding when to do maintenance tasks to keep the storage working well over time. 3. Making Devices Last Longer: By using the RTC for regular upkeep, we can make sure the storage device lasts longer and stays reliable. This is especially important for devices that need to work well for a long time. 4.Fitting In with Other Devices: The inclusion of RTC support aligns with existing UFS specifications (starting from UFS Spec 2.0) and is consistent with the prevalent industry practice. Many UFS devices currently on the market utilize RTC for internal timekeeping. By ensuring compatibility with this widely adopted standard, the embedded storage device becomes seamlessly integrable with existing hardware and software ecosystems, reducing the risk of compatibility issues. In short, adding RTC support to embedded storage device UFS helps with regular upkeep, extends the device's life, ensures compatibility, and keeps everything running smoothly with the rest of the system. Changelog: v4--v5: 1. Fix coding type issues in patch 2/3 2. Move ufs_rtc_update_work init to ufshcd_init() 3. Move ufshcd_state != UFSHCD_STATE_OPERATIONAL checkup out of ufshcd_is_ufs_dev_busy() 4. Remove inline keyword v3--v4: 1. Incorporate a check for "Current time precedes previous setting" in ufshcd_update_rtc() 2. Eliminate redundant return value code in ufshcd_update_rtc(). v2--v3: 1. Move ufshcd_is_ufs_dev_busy() to the source file ufshcd.c in patch 1/3. 2. Format commit statement in patch 2/3. v1--v2: 1. Add a new patch "scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()" 2. RTC periodic update work is disabled by default 3. Address several issues raised by Avri, Bart, and Thomas. Bean Huo (3): scsi: ufs: core: Add ufshcd_is_ufs_dev_busy() scsi: ufs: core: Add UFS RTC support scsi: ufs: core: Add sysfs node for UFS RTC update Documentation/ABI/testing/sysfs-driver-ufs | 7 ++ drivers/ufs/core/ufs-sysfs.c | 31 +++++++ drivers/ufs/core/ufshcd.c | 101 +++++++++++++++++++-- include/ufs/ufs.h | 14 +++ include/ufs/ufshcd.h | 4 + 5 files changed, 151 insertions(+), 6 deletions(-) -- 2.34.1