1. 10 11月, 2015 2 次提交
  2. 03 6月, 2015 5 次提交
  3. 10 4月, 2015 1 次提交
  4. 21 11月, 2014 1 次提交
  5. 01 10月, 2014 14 次提交
    • D
      ufs: definitions for phy interface · e785060e
      Dolev Raviv 提交于
      - Adding some of the definitions missing in unipro.h, including power
        enumeration.
      - Read Modify Write Line helper function
      - Indication for the type of suspend
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: NYaniv Gardi <ygardi@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      e785060e
    • S
      ufs: tune bkops while power managment events · 374a246e
      Subhash Jadavani 提交于
      Add capability to control the auto bkops during suspend.
      If host explicitly enables the auto bkops (background operation) on device
      then only device would perform the bkops on its own. If auto bkops is not
      enabled explicitly and if the device reaches to state where it must do
      background operation, device would raise the urgent bkops exception event
      to host and then host will enable the auto bkops on device. This patch
      adds the option to choose whether auto bkops should be enabled during
      runtime suspend or not. Since we don't want to keep the device active to
      perform the non critical bkops, host will enable urgent bkops only.
      
      Keep auto-bkops enabled after resume if urgent bkops needed.
      If device bkops status shows that its in critical need of executing
      background operations, host should allow the device to continue doing
      background operations.
      Signed-off-by: NSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      374a246e
    • S
      ufs: Add support for clock scaling using devfreq framework · 856b3483
      Sahitya Tummala 提交于
      The clocks for UFS device will be managed by generic DVFS (Dynamic
      Voltage and Frequency Scaling) framework within kernel. This devfreq
      framework works with different governors to scale the clocks. By default,
      UFS devices uses simple_ondemand governor which scales the clocks up if
      the load is more than upthreshold and scales down if the load is less than
      downthreshold.
      Signed-off-by: NSahitya Tummala <stummala@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      856b3483
    • S
      ufs: Add freq-table-hz property for UFS device · 4cff6d99
      Sahitya Tummala 提交于
      Add freq-table-hz propery for UFS device to keep track of
      <min max> frequencies supported by UFS clocks.
      Signed-off-by: NSahitya Tummala <stummala@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      4cff6d99
    • S
      ufs: Add support for clock gating · 1ab27c9c
      Sahitya Tummala 提交于
      The UFS controller clocks can be gated after certain period of
      inactivity, which is typically less than runtime suspend timeout.
      In addition to clocks the link will also be put into Hibern8 mode
      to save more power.
      
      The clock gating can be turned on by enabling the capability
      UFSHCD_CAP_CLK_GATING. To enable entering into Hibern8 mode as part of
      clock gating, set the capability UFSHCD_CAP_HIBERN8_WITH_CLK_GATING.
      
      The tracing events for clock gating can be enabled through debugfs as:
      echo 1 > /sys/kernel/debug/tracing/events/ufs/ufshcd_clk_gating/enable
      cat /sys/kernel/debug/tracing/trace_pipe
      Signed-off-by: NSahitya Tummala <stummala@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      1ab27c9c
    • D
      ufs: refactor configuring power mode · 7eb584db
      Dolev Raviv 提交于
      Sometimes, the device shall report its maximum power and speed
      capabilities, but we might not wish to configure it to use those
      maximum capabilities.
      This change adds support for the vendor specific host driver to
      implement power change notify callback.
      
      To enable configuring different power modes (number of lanes,
      gear number and fast/slow modes) it is necessary to split the
      configuration stage from the stage that reads the device max power mode.
      In addition, it is not required to read the configuration more than
      once, thus the configuration is stored after reading it once.
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NYaniv Gardi <ygardi@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      7eb584db
    • S
      ufs: add UFS power management support · 57d104c1
      Subhash Jadavani 提交于
      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: NSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      57d104c1
    • S
      ufs: introduce well known logical unit in ufs · 0ce147d4
      Subhash Jadavani 提交于
      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: NSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      0ce147d4
    • S
      ufs: manually add well known logical units · 2a8fa600
      Subhash Jadavani 提交于
      UFS device specification requires the UFS devices to support 4 well known
      logical units:
      	"REPORT_LUNS" (address: 01h)
      	"UFS Device" (address: 50h)
      	"RPMB" (address: 44h)
      	"BOOT" (address: 30h)
      
      UFS device's power management needs to be controlled by "POWER CONDITION"
      field of SSU (START STOP UNIT) command. But this "power condition" field
      will take effect only when its sent to "UFS device" well known logical unit
      hence we require the scsi_device instance to represent this logical unit in
      order for the UFS host driver to send the SSU command for power management.
      
      We also require the scsi_device instance for "RPMB" (Replay Protected
      Memory Block) LU so user space process can control this LU. User space may
      also want to have access to BOOT LU.
      
      This patch adds the scsi device instances for each of all well known LUs
      (except "REPORT LUNS" LU).
      Signed-off-by: NSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      2a8fa600
    • Y
      ufs: Active Power Mode - configuring bActiveICCLevel · 3a4bf06d
      Yaniv Gardi 提交于
      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: NRaviv Shvili <rshvili@codeaurora.org>
      Signed-off-by: NYaniv Gardi <ygardi@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      3a4bf06d
    • S
      ufs: improve init sequence · 1d337ec2
      Sujit Reddy Thumma 提交于
      In ->hce_enable_notify() callback the vendor specific initialization
      may carry out additional DME configuration using UIC commands and
      hence the UIC command completion interrupt enable bit should be set
      before the post reset notification.
      Add retries if the link-startup fails. This is required since due to
      hardware timing issues, the Uni-Pro link-startup might fail. The UFS
      HCI recovery procedure contradicts the Uni-Pro sequence. The UFS HCI
      specifies to resend DME_LINKSTARTUP command after IS.ULLS (link-lost
      interrupt) is received. The Uni-Pro specifies that if link-startup
      fails the link is in "down" state. The link-lost is indicated to the
      DME user only when the link is up. Hence, the UFS HCI recovery procedure
      of waiting for IS.ULLS and retrying link-startup may not work properly.
      
      At the end, if detection fails, power off (disable clocks, regulators,
      phy) if the UFS device detection fails. This saves power while UFS device
      is not embedded into the system.
      Signed-off-by: NSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      1d337ec2
    • S
      ufs: Add clock initialization support · c6e79dac
      Sujit Reddy Thumma 提交于
      Add generic clock initialization support for UFSHCD platform
      driver. The clock info is read from device tree using standard
      clock bindings. A generic max-clock-frequency-hz property is
      defined to save information on maximum operating clock frequency
      the h/w supports.
      Signed-off-by: NSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      c6e79dac
    • S
      ufs: Add regulator enable support · aa497613
      Sujit Reddy Thumma 提交于
      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: NSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      aa497613
    • S
      ufs: Allow vendor specific initialization · 5c0c28a8
      Sujit Reddy Thumma 提交于
      Some vendor specific controller versions might need to configure
      vendor specific - registers, clocks, voltage regulators etc. to
      initialize the host controller UTP layer and Uni-Pro stack.
      Provide some common initialization operations that can be used
      to configure vendor specifics. The methods can be extended in
      future, for example, for power mode transitions.
      
      The operations are vendor/board specific and hence determined with
      the help of compatible property in device tree.
      Signed-off-by: NSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      5c0c28a8
  6. 28 5月, 2014 4 次提交
  7. 07 9月, 2013 2 次提交
  8. 26 8月, 2013 3 次提交
    • S
      [SCSI] ufs: Add support for host assisted background operations · 66ec6d59
      Sujit Reddy Thumma 提交于
      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: NSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: NSantosh Y <santoshsy@gmail.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      66ec6d59
    • D
      [SCSI] ufs: Set fDeviceInit flag to initiate device initialization · 68078d5c
      Dolev Raviv 提交于
      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: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: NSantosh Y <santoshsy@gmail.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      68078d5c
    • S
      [SCSI] ufs: Add support for sending NOP OUT UPIU · 5a0b0cb9
      Sujit Reddy Thumma 提交于
      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: NSujit Reddy Thumma <sthumma@codeaurora.org>
      Signed-off-by: NDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: NSantosh Y <santoshsy@gmail.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      5a0b0cb9
  9. 29 6月, 2013 3 次提交
  10. 26 2月, 2013 1 次提交