30 Sep, 2016

3 commits

  • Currently if we have PCI and UFSHCD configured in the kernel, both
    SCSI_UFS_DWC_TC_PCI and SCSI_UFSHCD_PCI show up, which is not correct.
    This patch changes the UFS Kconfig to assure hierarchy between the 2
    options.

    Signed-off-by: Joao Pinto
    Signed-off-by: Martin K. Petersen

    Joao Pinto
     
  • Fix to return a negative error code from the error handling case instead
    of 0, as done elsewhere in this function.

    Signed-off-by: Wei Yongjun
    Reviewed-by: Subhash Jadavani
    Reviewed-by: Kiwoong Kim
    Signed-off-by: Martin K. Petersen

    Wei Yongjun
     
  • Some devices have problems handling a Query UPIU with Data Segment
    set. Only set it for WRITE DESCRIPTOR commands.

    [mkp: updated patch description]

    Signed-off-by: Zang Leigang
    Reviewed-by: Subhash Jadavani
    Reviewed-by: Kiwoong Kim
    Signed-off-by: Martin K. Petersen

    Zang Leigang
     

28 Sep, 2016

1 commit


22 Sep, 2016

1 commit

  • When any UFS host controller receives a TM(Task Management) response
    from a UFS device, UFS driver has been recognize like receiving a
    message of "Task Management Function Complete"(00h) in all cases, so
    far. That means there is no pending task for a tag of the TM request
    sent before in the UFS device. That's because the byte offset 6 in TM
    response which has been used to get a TM service response so far
    represents just whether or not a TM transmission passes.

    Regarding UFS spec, the correct byte offset to get TM service response
    is 15, not 6.

    I tested that UFS driver responds properly for the TM response from a
    UFS device with an reference board with exynos8890, as follow: No
    pending task -> Task Management Function Complete (00h) Pending task ->
    Task Management Function Succeeded (08h)

    [mkp: applied by hand]

    Signed-off-by: Kiwoong Kim
    Signed-off-by: HeonGwang Chu
    Tested-by: : Kiwoong Kim
    Signed-off-by: Martin K. Petersen

    Kiwoong Kim
     

09 Sep, 2016

1 commit


04 Sep, 2016

1 commit

  • We get 2 warnings when build kernel with W=1:
    drivers/scsi/ufs/tc-dwc-g210.c:261:5: warning: no previous prototype for 'tc_dwc_g210_config_40_bit' [-Wmissing-prototypes]
    drivers/scsi/ufs/tc-dwc-g210.c:293:5: warning: no previous prototype for 'tc_dwc_g210_config_20_bit' [-Wmissing-prototypes]

    In fact, these functions are declared in ufs/tc-dwc-g210.h, so this
    patch add missing header dependencies

    Signed-off-by: Baoyou Xie
    Signed-off-by: Martin K. Petersen

    Baoyou Xie
     

16 Jul, 2016

2 commits


13 Jul, 2016

9 commits


19 Mar, 2016

1 commit

  • A recent change to ufshcd introduced a call to utf16s_to_utf8s, a
    function that is provided by the NLS module, so we get a link error when
    that is not present:

    drivers/scsi/built-in.o: In function `ufshcd_read_string_desc':
    :(.text+0x124d0): undefined reference to `utf16s_to_utf8s'

    This adds a Kconfig 'select' statement to avoid the build error.

    Signed-off-by: Arnd Bergmann
    Fixes: b573d484e4ff ("scsi: ufs: add support to read device and string descriptors")
    Signed-off-by: Martin K. Petersen

    Arnd Bergmann
     

15 Mar, 2016

17 commits

  • This change adds printouts of testbus and debug registers.

    Reviewed-by: Gilad Broner
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • This change enables the device ref clock before changing to HS mode
    and disables it if entered to PWM mode.

    Reviewed-by: Gilad Broner
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • Some UFS devices (and may be host) have issues if LCC is
    enabled. So we are setting PA_Local_TX_LCC_Enable to 0
    before link startup which will make sure that both host
    and device TX LCC are disabled once link startup is
    completed.

    Reviewed-by: Gilad Broner
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • We put the UFS device in sleep state & UFS link in hibern8 state during
    runtime suspend. After this we put all the UFS rails in low power
    modes immediately but it seems some devices may still draw more than
    sleep current from UFS rails (especially from VCCQ rail) at-least for
    500us.
    To avoid this situation, this change adds 2ms delay before putting
    these UFS rails in LPM mode.

    Reviewed-by: Gilad Broner
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Subhash Jadavani
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • Currently when we try to put the link in off/disabled state during
    suspend, it seems link is not being kept in low power mode.
    This patch fixes the issue by putting the link in hibern8 first
    (so device also puts the link in low power mode) and then stop the
    host controller.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Subhash Jadavani
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • Optimal values of local UniPro parameters like PA_Hibern8Time &
    PA_TActivate can help reduce the hibern8 exit latency. If both host and
    device supports UniPro ver1.6 or later, these parameters will be
    automatically tuned during link startup itself. But if either host or
    device doesn't support UniPro ver 1.6 or later, we have to manually
    tune them. But to keep manual tuning logic simple, we will only do
    manual tuning if local unipro version doesn't support ver1.6 or later.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Subhash Jadavani
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • We are seeing that some devices are raising the urgent bkops exception
    events even when BKOPS status doesn't indicate performace impacted or
    critical. Handle these device by determining their urgent bkops status
    at runtime.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Subhash Jadavani
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • Query commands have 100ms timeout and it may timeout if they are
    issued in parallel to ongoing read/write SCSI commands, this change
    adds the retry (max: 10) in case command timeouts.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Subhash Jadavani
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • Some vendor's UFS device sends back to back NACs for the DL data frames
    causing the host controller to raise the DFES error status. Sometimes
    such UFS devices send back to back NAC without waiting for new
    retransmitted DL frame from the host and in such cases it might be
    possible the Host UniPro goes into bad state without raising the DFES
    error interrupt. If this happens then all the pending commands would
    timeout only after respective SW command (which is generally too
    large).

    This change workarounds such device behaviour like this:
    - As soon as SW sees the DL NAC error, it would schedule the error
    handler
    - Error handler would sleep for 50ms to see if there any fatal errors
    raised by UFS controller.
    - If there are fatal errors then SW does normal error recovery.
    - If there are no fatal errors then SW sends the NOP command to
    device to check if link is alive.
    - If NOP command times out, SW does normal error recovery
    - If NOP command succeed, skip the error handling.

    If DL NAC error is seen multiple times with some vendor's UFS devices
    then enable this quirk to initiate quick error recovery and also
    silence related error logs to reduce spamming of kernel logs.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Subhash Jadavani
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • UFS driver's error handler forcefully tries to clear all the pending
    requests. For each pending request in the queue, it waits 1 sec for it
    to get cleared. If we have multiple requests in the queue then it's
    possible that we might end up waiting for those many seconds before
    resetting the host. But note that resetting host would any way clear
    all the pending requests from the hardware. Hence this change skips
    the forceful clear of the pending requests if we are anyway going to
    reset the host (for fatal errors).

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Subhash Jadavani
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • Some UFS devices don't require VCCQ rail for device operations hence
    this change adds support to recognize such devices and remove vote for
    the unused VCCQ rail.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Subhash Jadavani
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • Currently we use the host quirks mechanism in order to
    handle both device and host controller quirks.
    In order to support various of UFS devices we should separate
    handling the device quirks from the host controller's.

    Reviewed-by: Gilad Broner
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Raviv Shvili
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • This change adds support to read device descriptor and string descriptor
    from a UFS device

    Reviewed-by: Gilad Broner
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Raviv Shvili
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • Sometimes due to hw issues it takes some time to the
    host controller register to update. In order to verify the register
    has updated, a polling is done until its value is set.

    In addition the functions ufshcd_hba_stop() and
    ufshcd_wait_for_register() was updated with an additional input
    parameter, indicating the timeout between reads will
    be done by sleeping or spinning the cpu.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Raviv Shvili
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • A race condition exists between request requeueing and scsi layer
    error handling:
    When UFS driver queuecommand returns a busy status for a request,
    it will be requeued and its tag will be freed and set to -1.
    At the same time it is possible that the request will timeout and
    scsi layer will start error handling for it. The scsi layer reuses
    the request and its tag to send error related commands to the device,
    however its tag is no longer valid.
    As this request was never really sent to the device, there is no
    point to start error handling with the device.
    Implement the scsi error handling timeout callback and bypass SCSI
    error handling for request that were not actually sent to the device.
    For such requests simply reset the block layer timer. Otherwise, let
    SCSI layer perform the usual error handling.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Gilad Broner
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • When control reaches to Linux UFS driver during UFS boot mode, UFS host
    controller interrupt status/enable registers may have left over
    settings.
    In order to avoid any spurious interrupts due to these left overs,
    it's important to clear these interrupt status/enable registers before
    enabling UFS interrupt handling.

    Reviewed-by: Hannes Reinecke
    Signed-off-by: Subhash Jadavani
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     
  • Different platform may have different number of lanes
    for the UFS link.
    Add parameter to device tree specifying how many lanes
    should be configured for the UFS link.

    Reviewed-by: Hannes Reinecke
    Acked-by: Rob Herring
    Signed-off-by: Gilad Broner
    Signed-off-by: Yaniv Gardi
    Signed-off-by: Martin K. Petersen

    Yaniv Gardi
     

24 Feb, 2016

4 commits