From patchwork Fri Sep 28 23:02:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Green X-Patchwork-Id: 10620521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2522C175A for ; Fri, 28 Sep 2018 23:02:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05A342BDEC for ; Fri, 28 Sep 2018 23:02:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC5EE2BE34; Fri, 28 Sep 2018 23:02:15 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 0B8952BDEC for ; Fri, 28 Sep 2018 23:02:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727251AbeI2F2I (ORCPT ); Sat, 29 Sep 2018 01:28:08 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36775 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726701AbeI2F2H (ORCPT ); Sat, 29 Sep 2018 01:28:07 -0400 Received: by mail-pf1-f195.google.com with SMTP id b7-v6so5254579pfo.3 for ; Fri, 28 Sep 2018 16:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=XlMXzEpl7A0j0zzL8gHRJKduxTuJfkyCwPkYZ5mhMq8=; b=BnOLMEslJ6/bWb2megRSBQoTdO92vXp7wVuYCuah4mO8sCCBoia+nTbBbjl/l64Xwg 6uo41aM9z75pb+X2+pg4BbJHRv56ltJd1Acc2pC49tWOjTsq6xHyOwrLjx0xaWVngezR X+hps9cSJxpMArRISBdz0k02T0Pig8WW7xLPA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XlMXzEpl7A0j0zzL8gHRJKduxTuJfkyCwPkYZ5mhMq8=; b=VDgWR6vmXGoQV1Ar31WnPaaLBL/cXqEXdE7hNB82mHrF7BNF2he7CXhmpzYP9bNgCr PhXL5VsBd8TcfPmroF2WJBC04X7we5jTBGZmVdknuEGwJv41l3jHZfxB7xudrjn5Sx0U 7F4KH00zTRDzT4CCA9HwNKToQ2NIYzzf+uBJpXAq/uxiwPdvn0BZd0WBK27ke2j1IYUW l8wr9owztuiFHDunT3iFg+IHe8gfFhqlhclbwNCwAA9qE2nSFvjDYC+DpltRDeZXXZST 4xqdBsrm2EdHXILsrd0ua44tsS6XOPlmX4eQDQV8eB1vsZYe8fMuEBF0M/vXgx8E/tNi k0TQ== X-Gm-Message-State: ABuFfoi6gK3+xWKvdqrb00tdNqWDVZq24vPD9LwsAR5U+8Md+TwDoAnb 9B9kW/UTgiQy2XXDe+qOjiAqwQ== X-Google-Smtp-Source: ACcGV63ASrjDB0tTqdPOIavGpn3JOoLWMMe/dd4TAk6Uq/8j/At71mEziBlX5TgORCD8UPpDpYIIng== X-Received: by 2002:a17:902:ba8b:: with SMTP id k11-v6mr714771pls.12.1538175729079; Fri, 28 Sep 2018 16:02:09 -0700 (PDT) Received: from evgreen2.mtv.corp.google.com ([2620:15c:202:201:e418:c825:76cf:5f64]) by smtp.gmail.com with ESMTPSA id a2-v6sm7303802pgc.68.2018.09.28.16.02.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Sep 2018 16:02:08 -0700 (PDT) From: Evan Green To: Vinayak Holikatti , "James E.J. Bottomley" , "Martin K. Petersen" , Adrian Hunter , Stanislav Nijnikov , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Evan Green , Douglas Anderson , Gwendal Grignou Subject: [PATCH v2 0/2] scsi: ufs: Enable bInitPowerMode of sleep Date: Fri, 28 Sep 2018 16:02:01 -0700 Message-Id: <20180928230203.905-1-evgreen@chromium.org> X-Mailer: git-send-email 2.16.4 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 change enables Linux to enumerate UFS devices that have been configured to start in an initial power mode (bInitPowerMode) of sleep. The UFS spec indicates that for devices in sleep mode, a START_STOP_UNIT SCSI command must be sent to them to wake them up before doing other initialization tasks like getting the device or geometry descriptors. This is not trivial to do in the UFS driver, since it assumes that SCSI commands are only needed once low level initialization of the device is complete. These patches 1) Enable sending SCSI commands before the actual SCSI targets are created, and 2) Sends the needed commands for devices in sleep mode. This can be tested locally by setting byte 5 of the Configuration Descriptor (bInitPowerMode) to zero, and rebooting. I discovered this bug by accidentally zeroing out too many fields while I was testing provisioning functionality. Note: This series is unrelated to (and independent of) the competing UFS provisioning patches that have been floating around the list lately. Changes since v1: * Split into two patches for easier comprehension. Can recombine to one if this split is too contrived. * Fixed a leftover raw printk. Evan Green (2): scsi: ufs: Allow SCSI commands early during init scsi: ufs: Execute START_STOP_UNIT during init drivers/scsi/ufs/ufshcd.c | 208 +++++++++++++++++++++++++++++++++++++++++++--- drivers/scsi/ufs/ufshcd.h | 11 +++ 2 files changed, 206 insertions(+), 13 deletions(-)