1. 01 Dec, 2018 1 commit
  2. 01 Oct, 2014 6 commits
    • Subhash Jadavani's avatar
      ufs: add UFS power management support · 57d104c1
      Subhash Jadavani authored
      
      
      This patch adds support for UFS device and UniPro link power management
      during runtime/system PM.
      
      Main idea is to define multiple UFS low power levels based on UFS device
      and UFS link power states. This would allow any specific platform or pci
      driver to choose the best suited low power level during runtime and
      system suspend based on their power goals.
      
      bkops handlig:
      To put the UFS device in sleep state when bkops is disabled, first query
      the bkops status from the device and enable bkops on device only if
      device needs time to perform the bkops.
      
      START_STOP handling:
      Before sending START_STOP_UNIT to the device well-known logical unit
      (w-lun) to make sure that the device w-lun unit attention condition is
      cleared.
      
      Write protection:
      UFS device specification allows LUs to be write protected, either
      permanently or power on write protected. If any LU is power on write
      protected and if the card is power cycled (by powering off VCCQ and/or
      VCC rails), LU's write protect status would be lost. So this means those
      LUs can be written now. To ensures that UFS device is power cycled only
      if the power on protect is not set for any of the LUs, check if power on
      write protect is set and if device is in sleep/power-off state & link in
      inactive state (Hibern8 or OFF state).
      If none of the Logical Units on UFS device is power on write protected
      then all UFS device power rails (VCC, VCCQ & VCCQ2) can be turned off if
      UFS device is in power-off state and UFS link is in OFF state. But current
      implementation would disable all device power rails even if UFS link is
      not in OFF state.
      
      Low power mode:
      If UFS link is in OFF state then UFS host controller can be power collapsed
      to avoid leakage current from it. Note that if UFS host controller is power
      collapsed, full UFS reinitialization will be required on resume to
      re-establish the link between host and device.
      Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      57d104c1
    • Subhash Jadavani's avatar
      ufs: introduce well known logical unit in ufs · 0ce147d4
      Subhash Jadavani authored
      
      
      UFS device may have standard LUs and LUN id could be from 0x00 to 0x7F.
      UFS device specification use "Peripheral Device Addressing Format"
      (SCSI SAM-5) for standard LUs.
      
      UFS device may also have the Well Known LUs (also referred as W-LU) which
      again could be from 0x00 to 0x7F. For W-LUs, UFS device specification only
      allows the "Extended Addressing Format" (SCSI SAM-5) which means the W-LUNs
      would start from 0xC100 onwards.
      
      This means max. LUN number reported from UFS device could be 0xC17F hence
      this patch advertise the "max_lun" as 0xC17F which will allow SCSI mid
      layer to detect the W-LUs as well.
      
      But once the W-LUs are detected, UFSHCD driver may get the commands with
      SCSI LUN id upto 0xC17F but UPIU LUN id field is only 8-bit wide so it
      requires the mapping of SCSI LUN id to UPIU LUN id. This patch also add
      support for this mapping.
      Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      0ce147d4
    • Yaniv Gardi's avatar
      ufs: Active Power Mode - configuring bActiveICCLevel · 3a4bf06d
      Yaniv Gardi authored
      
      
      The maximum power consumption in active is determined by bActiveICCLevel.
      The configuration is done by reading max current supported by the
      regulators connected to VCC, VCCQ and VCCQ2 rails on the boards, and
      reading the current consumption levels from the device for each rails
      (vcc/vccq/vccq2) using power descriptor.
      We configure the bActiveICCLevel attribute, with the max value that
      correspond to the minimum-of(VCC-current-level,VCCQ-current-level,
      VCCQ2-current-level).
      In order to minimize resume latency, pre-fetch icc levels and reference
      clock during initialization and avoid reading them each link startup
      during resume.
      Signed-off-by: default avatarRaviv Shvili <rshvili@codeaurora.org>
      Signed-off-by: default avatarYaniv Gardi <ygardi@codeaurora.org>
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      3a4bf06d
    • Subhash Jadavani's avatar
      ufs: refactor query descriptor API support · da461cec
      Subhash Jadavani authored
      
      
      Currently reading query descriptor is more tightened to each
      descriptor type. This patch generalize the approach and allows
      reading any parameter from any query descriptor.
      Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      da461cec
    • Raviv Shvili's avatar
      ufs: add voting support for host controller power · 6a771a65
      Raviv Shvili authored
      
      
      Add the support for voting of the regulator powering the
      host controller logic.
      Signed-off-by: default avatarRaviv Shvili <rshvili@codeaurora.org>
      Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      6a771a65
    • Sujit Reddy Thumma's avatar
      ufs: Add regulator enable support · aa497613
      Sujit Reddy Thumma authored
      
      
      UFS devices are powered by at most three external power supplies -
      - VCC - The flash memory core power supply, 2.7V to 3.6V or 1.70V to 1.95V
      - VCCQ - The controller and I/O power supply, 1.1V to 1.3V
      - VCCQ2 - Secondary controller and/or I/O power supply, 1.65V to 1.95V
      
      For some devices VCCQ or VCCQ2 are optional as they can be
      generated using internal LDO inside the UFS device.
      
      Add DT bindings for voltage regulators that can be controlled
      from host driver.
      Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      aa497613
  3. 25 Jul, 2014 2 commits
  4. 28 May, 2014 1 commit
  5. 06 Sep, 2013 1 commit
  6. 26 Aug, 2013 3 commits
    • Sujit Reddy Thumma's avatar
      [SCSI] ufs: Add support for host assisted background operations · 66ec6d59
      Sujit Reddy Thumma authored
      
      
      Background operations in the UFS device can be disabled by
      the host to reduce the response latency of transfer requests.
      Add support for enabling/disabling the background operations
      during runtime suspend/resume of the device.
      
      If the device is in critical need of BKOPS it will raise an
      URGENT_BKOPS exception which should be handled by the host to
      make sure the device performs as expected.
      
      During bootup, the BKOPS is enabled in the device by default.
      The disable of BKOPS is supported only when the driver supports
      runtime suspend/resume operations as the runtime PM framework
      provides a way to determine the device idleness and hence BKOPS
      can be managed effectively. During runtime resume the BKOPS is
      disabled to reduce latency and during runtime suspend the BKOPS
      is enabled to allow device to carry out idle time BKOPS.
      
      In some cases where the BKOPS is disabled during runtime resume
      and due to continuous data transfers the runtime suspend is not
      triggered, the BKOPS is enabled when the device raises a level-2
      exception (outstanding operations - performance impact).
      Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: default avatarSantosh Y <santoshsy@gmail.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      66ec6d59
    • Dolev Raviv's avatar
      [SCSI] ufs: Set fDeviceInit flag to initiate device initialization · 68078d5c
      Dolev Raviv authored
      
      
      Allow UFS device to complete its initialization and accept
      SCSI commands by setting fDeviceInit flag. The device may take
      time for this operation and hence the host should poll until
      fDeviceInit flag is toggled to zero. This step is mandated by
      UFS device specification for device initialization completion.
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: default avatarSantosh Y <santoshsy@gmail.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      68078d5c
    • Sujit Reddy Thumma's avatar
      [SCSI] ufs: Add support for sending NOP OUT UPIU · 5a0b0cb9
      Sujit Reddy Thumma authored
      
      
      As part of device initialization sequence, sending NOP OUT UPIU and
      waiting for NOP IN UPIU response is mandatory. This confirms that the
      device UFS Transport (UTP) layer is functional and the host can configure
      the device with further commands. Add support for sending NOP OUT UPIU to
      check the device connection path and test whether the UTP layer on the
      device side is functional during initialization.
      
      A tag is acquired from the SCSI tag map space in order to send the device
      management command. When the tag is acquired by internal command the scsi
      command is rejected with host busy flag in order to requeue the request.
      To avoid frequent collisions between internal commands and scsi commands
      the device management command tag is allocated in the opposite direction
      w.r.t block layer tag allocation.
      Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarSantosh Y <santoshsy@gmail.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      5a0b0cb9
  7. 25 Feb, 2013 1 commit
  8. 27 Mar, 2012 1 commit