Re: [PATCH V7 1/6] scsi: ufs: fix endianness sparse warnings

2013-09-23 Thread vinayak holikatti
On Thu, Sep 19, 2013 at 4:44 PM, Sujit Reddy Thumma
sthu...@codeaurora.org wrote:

 Fix many warnings with incorrect endian assumptions
 which makes the code unportable to new architectures.

 The UFS specification defines the byte order as big-endian
 for UPIU structure and little-endian for the host controller
 transfer/task management descriptors.

 Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
 ---
  drivers/scsi/ufs/ufs.h| 36 ++--
  drivers/scsi/ufs/ufshcd.c | 42 --
  drivers/scsi/ufs/ufshci.h | 32 
  3 files changed, 42 insertions(+), 68 deletions(-)

 diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
 index 7210500..f42d1ce 100644
 --- a/drivers/scsi/ufs/ufs.h
 +++ b/drivers/scsi/ufs/ufs.h
 @@ -196,9 +196,9 @@ enum {
   * @dword_2: UPIU header DW-2
   */
  struct utp_upiu_header {
 -   u32 dword_0;
 -   u32 dword_1;
 -   u32 dword_2;
 +   __be32 dword_0;
 +   __be32 dword_1;
 +   __be32 dword_2;
  };

  /**
 @@ -207,7 +207,7 @@ struct utp_upiu_header {
   * @cdb: Command Descriptor Block CDB DW-4 to DW-7
   */
  struct utp_upiu_cmd {
 -   u32 exp_data_transfer_len;
 +   __be32 exp_data_transfer_len;
 u8 cdb[MAX_CDB_SIZE];
  };

 @@ -228,10 +228,10 @@ struct utp_upiu_query {
 u8 idn;
 u8 index;
 u8 selector;
 -   u16 reserved_osf;
 -   u16 length;
 -   u32 value;
 -   u32 reserved[2];
 +   __be16 reserved_osf;
 +   __be16 length;
 +   __be32 value;
 +   __be32 reserved[2];
  };

  /**
 @@ -256,9 +256,9 @@ struct utp_upiu_req {
   * @sense_data: Sense data field DW-8 to DW-12
   */
  struct utp_cmd_rsp {
 -   u32 residual_transfer_count;
 -   u32 reserved[4];
 -   u16 sense_data_len;
 +   __be32 residual_transfer_count;
 +   __be32 reserved[4];
 +   __be16 sense_data_len;
 u8 sense_data[18];
  };

 @@ -286,10 +286,10 @@ struct utp_upiu_rsp {
   */
  struct utp_upiu_task_req {
 struct utp_upiu_header header;
 -   u32 input_param1;
 -   u32 input_param2;
 -   u32 input_param3;
 -   u32 reserved[2];
 +   __be32 input_param1;
 +   __be32 input_param2;
 +   __be32 input_param3;
 +   __be32 reserved[2];
  };

  /**
 @@ -301,9 +301,9 @@ struct utp_upiu_task_req {
   */
  struct utp_upiu_task_rsp {
 struct utp_upiu_header header;
 -   u32 output_param1;
 -   u32 output_param2;
 -   u32 reserved[3];
 +   __be32 output_param1;
 +   __be32 output_param2;
 +   __be32 reserved[3];
  };

  /**
 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
 index 04884d6..064c9d9 100644
 --- a/drivers/scsi/ufs/ufshcd.c
 +++ b/drivers/scsi/ufs/ufshcd.c
 @@ -163,7 +163,7 @@ static inline int ufshcd_is_device_present(u32 reg_hcs)
   */
  static inline int ufshcd_get_tr_ocs(struct ufshcd_lrb *lrbp)
  {
 -   return lrbp-utr_descriptor_ptr-header.dword_2  MASK_OCS;
 +   return le32_to_cpu(lrbp-utr_descriptor_ptr-header.dword_2)  
 MASK_OCS;
  }

  /**
 @@ -176,7 +176,7 @@ static inline int ufshcd_get_tr_ocs(struct ufshcd_lrb 
 *lrbp)
  static inline int
  ufshcd_get_tmr_ocs(struct utp_task_req_desc *task_req_descp)
  {
 -   return task_req_descp-header.dword_2  MASK_OCS;
 +   return le32_to_cpu(task_req_descp-header.dword_2)  MASK_OCS;
  }

  /**
 @@ -390,26 +390,6 @@ static inline void ufshcd_copy_sense_data(struct 
 ufshcd_lrb *lrbp)
  }

  /**
 - * ufshcd_query_to_cpu() - formats the buffer to native cpu endian
 - * @response: upiu query response to convert
 - */
 -static inline void ufshcd_query_to_cpu(struct utp_upiu_query *response)
 -{
 -   response-length = be16_to_cpu(response-length);
 -   response-value = be32_to_cpu(response-value);
 -}
 -
 -/**
 - * ufshcd_query_to_be() - formats the buffer to big endian
 - * @request: upiu query request to convert
 - */
 -static inline void ufshcd_query_to_be(struct utp_upiu_query *request)
 -{
 -   request-length = cpu_to_be16(request-length);
 -   request-value = cpu_to_be32(request-value);
 -}
 -
 -/**
   * ufshcd_copy_query_response() - Copy the Query Response and the data
   * descriptor
   * @hba: per adapter instance
 @@ -425,7 +405,6 @@ void ufshcd_copy_query_response(struct ufs_hba *hba, 
 struct ufshcd_lrb *lrbp)
 UPIU_RSP_CODE_OFFSET;

 memcpy(query_res-upiu_res, lrbp-ucd_rsp_ptr-qr, QUERY_OSF_SIZE);
 -   ufshcd_query_to_cpu(query_res-upiu_res);


 /* Get the descriptor */
 @@ -749,7 +728,7 @@ static void ufshcd_prepare_utp_query_req_upiu(struct 
 ufs_hba *hba,
  {
 struct utp_upiu_req *ucd_req_ptr = lrbp-ucd_req_ptr;
 struct ufs_query *query = hba-dev_cmd.query;
 -   u16 len = query-request.upiu_req.length;
 +   u16 len = be16_to_cpu(query-request.upiu_req.length);
 u8 *descp = (u8 *)lrbp-ucd_req_ptr + 

Re: [PATCH V7 2/6] scsi: ufs: make undeclared functions static

2013-09-23 Thread vinayak holikatti
On Thu, Sep 19, 2013 at 4:44 PM, Sujit Reddy Thumma
sthu...@codeaurora.org wrote:
 Make undeclared functions static and declare exported symbols
 to suppress warnings from sparse tool.

 Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
 ---
  drivers/scsi/ufs/ufshcd.c | 4 ++--
  drivers/scsi/ufs/ufshcd.h | 2 ++
  2 files changed, 4 insertions(+), 2 deletions(-)

 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
 index 064c9d9..d476cc3 100644
 --- a/drivers/scsi/ufs/ufshcd.c
 +++ b/drivers/scsi/ufs/ufshcd.c
 @@ -1148,7 +1148,7 @@ out_unlock:
   *
   * Returns 0 for success, non-zero in case of failure
  */
 -int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode,
 +static int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode,
 enum attr_idn idn, u8 index, u8 selector, u32 
 *attr_val)
  {
 struct ufs_query_req *request;
 @@ -1459,7 +1459,7 @@ EXPORT_SYMBOL_GPL(ufshcd_dme_get_attr);
   *
   * Returns 0 on success, non-zero value on failure
   */
 -int ufshcd_uic_change_pwr_mode(struct ufs_hba *hba, u8 mode)
 +static int ufshcd_uic_change_pwr_mode(struct ufs_hba *hba, u8 mode)
  {
 struct uic_command uic_cmd = {0};
 struct completion pwr_done;
 diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
 index 577679a..767ee9e 100644
 --- a/drivers/scsi/ufs/ufshcd.h
 +++ b/drivers/scsi/ufs/ufshcd.h
 @@ -263,6 +263,8 @@ static inline void check_upiu_size(void)
 GENERAL_UPIU_REQUEST_SIZE + QUERY_DESC_MAX_SIZE);
  }

 +extern int ufshcd_suspend(struct ufs_hba *hba, pm_message_t state);
 +extern int ufshcd_resume(struct ufs_hba *hba);
  extern int ufshcd_runtime_suspend(struct ufs_hba *hba);
  extern int ufshcd_runtime_resume(struct ufs_hba *hba);
  extern int ufshcd_runtime_idle(struct ufs_hba *hba);


Acked-by: Vinayak Holikatti vinholika...@gmail.com
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V7 4/6] scsi: ufs: Fix hardware race conditions while aborting a command

2013-09-23 Thread vinayak holikatti
On Thu, Sep 19, 2013 at 4:44 PM, Sujit Reddy Thumma
sthu...@codeaurora.org wrote:
 There is a possible race condition in the hardware when the abort
 command is issued to terminate the ongoing SCSI command as described
 below:

 - A bit in the door-bell register is set in the controller for a
   new SCSI command.
 - In some rare situations, before controller get a chance to issue
   the command to the device, the software issued an abort command.
 - If the device recieves abort command first then it returns success
   because the command itself is not present.
 - Now if the controller commits the command to device it will be
   processed.
 - Software thinks that command is aborted and proceed while still
   the device is processing it.
 - The software, controller and device may go out of sync because of
   this race condition.

 To avoid this, query task presence in the device before sending abort
 task command so that after the abort operation, the command is guaranteed
 to be non-existent in both controller and the device.

 Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
 Reviewed-by: Yaniv Gardi yga...@codeaurora.org
 Tested-by: Dolev Raviv dra...@codeaurora.org
 ---
  drivers/scsi/ufs/ufshcd.c | 70 
 +--
  1 file changed, 55 insertions(+), 15 deletions(-)

 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
 index c3acadc..52f66e4 100644
 --- a/drivers/scsi/ufs/ufshcd.c
 +++ b/drivers/scsi/ufs/ufshcd.c
 @@ -2695,6 +2695,12 @@ static int ufshcd_host_reset(struct scsi_cmnd *cmd)
   * ufshcd_abort - abort a specific command
   * @cmd: SCSI command pointer
   *
 + * Abort the pending command in device by sending UFS_ABORT_TASK task 
 management
 + * command, and in host controller by clearing the door-bell register. There 
 can
 + * be race between controller sending the command to the device while abort 
 is
 + * issued. To avoid that, first issue UFS_QUERY_TASK to check if the command 
 is
 + * really issued and then try to abort it.
 + *
   * Returns SUCCESS/FAILED
   */
  static int ufshcd_abort(struct scsi_cmnd *cmd)
 @@ -2703,7 +2709,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
 struct ufs_hba *hba;
 unsigned long flags;
 unsigned int tag;
 -   int err;
 +   int err = 0;
 +   int poll_cnt;
 u8 resp = 0xF;
 struct ufshcd_lrb *lrbp;

 @@ -2711,33 +2718,59 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
 hba = shost_priv(host);
 tag = cmd-request-tag;

 -   spin_lock_irqsave(host-host_lock, flags);
 +   /* If command is already aborted/completed, return SUCCESS */
 +   if (!(test_bit(tag, hba-outstanding_reqs)))
 +   goto out;

 -   /* check if command is still pending */
 -   if (!(test_bit(tag, hba-outstanding_reqs))) {
 -   err = FAILED;
 -   spin_unlock_irqrestore(host-host_lock, flags);
 +   lrbp = hba-lrb[tag];
 +   for (poll_cnt = 100; poll_cnt; poll_cnt--) {
 +   err = ufshcd_issue_tm_cmd(hba, lrbp-lun, lrbp-task_tag,
 +   UFS_QUERY_TASK, resp);
 +   if (!err  resp == UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED) {
 +   /* cmd pending in the device */
 +   break;
 +   } else if (!err  resp == UPIU_TASK_MANAGEMENT_FUNC_COMPL) {
 +   u32 reg;
 +
 +   /*
 +* cmd not pending in the device, check if it is
 +* in transition.
 +*/
 +   reg = ufshcd_readl(hba, 
 REG_UTP_TRANSFER_REQ_DOOR_BELL);
 +   if (reg  (1  tag)) {
 +   /* sleep for max. 200us to stabilize */
 +   usleep_range(100, 200);
 +   continue;
 +   }
 +   /* command completed already */
 +   goto out;
 +   } else {
 +   if (!err)
 +   err = resp; /* service response error */
 +   goto out;
 +   }
 +   }
 +
 +   if (!poll_cnt) {
 +   err = -EBUSY;
 goto out;
 }
 -   spin_unlock_irqrestore(host-host_lock, flags);

 -   lrbp = hba-lrb[tag];
 err = ufshcd_issue_tm_cmd(hba, lrbp-lun, lrbp-task_tag,
 UFS_ABORT_TASK, resp);
 if (err || resp != UPIU_TASK_MANAGEMENT_FUNC_COMPL) {
 -   err = FAILED;
 +   if (!err)
 +   err = resp; /* service response error */
 goto out;
 -   } else {
 -   err = SUCCESS;
 }

 +   err = ufshcd_clear_cmd(hba, tag);
 +   if (err)
 +   goto out;
 +
 scsi_dma_unmap(cmd);

 spin_lock_irqsave(host-host_lock, flags);
 -
 -   /* 

Re: [PATCH V7 3/6] scsi: ufs: Fix broken task management command implementation

2013-09-23 Thread vinayak holikatti
On Thu, Sep 19, 2013 at 4:44 PM, Sujit Reddy Thumma
sthu...@codeaurora.org wrote:
 Currently, sending Task Management (TM) command to the card might
 be broken in some scenarios as listed below:

 Problem: If there are more than 8 TM commands the implementation
  returns error to the caller.
 Fix: Wait for one of the slots to be emptied and send the command.

 Problem: Sometimes it is necessary for the caller to know the TM service
  response code to determine the task status.
 Fix: Propogate the service response to the caller.

 Problem: If the TM command times out no proper error recovery is
  implemented.
 Fix: Clear the command in the controller door-bell register, so that
  further commands for the same slot don't fail.

 Problem: While preparing the TM command descriptor, the task tag used
  should be unique across SCSI/NOP/QUERY/TM commands and not the
  task tag of the command which the TM command is trying to manage.
 Fix: Use a unique task tag instead of task tag of SCSI command.

 Problem: Since the TM command involves H/W communication, abruptly ending
  the request on kill interrupt signal might cause h/w malfunction.
 Fix: Wait for hardware completion interrupt with TASK_UNINTERRUPTIBLE
  set.

 Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
 Reviewed-by: Yaniv Gardi yga...@codeaurora.org
 Tested-by: Dolev Raviv dra...@codeaurora.org
 ---
  drivers/scsi/ufs/ufshcd.c | 169 
 +++---
  drivers/scsi/ufs/ufshcd.h |   8 ++-
  2 files changed, 122 insertions(+), 55 deletions(-)

 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
 index d476cc3..c3acadc 100644
 --- a/drivers/scsi/ufs/ufshcd.c
 +++ b/drivers/scsi/ufs/ufshcd.c
 @@ -55,6 +55,9 @@
  /* Query request timeout */
  #define QUERY_REQ_TIMEOUT 30 /* msec */

 +/* Task management command timeout */
 +#define TM_CMD_TIMEOUT 100 /* msecs */
 +
  /* Expose the flag value from utp_upiu_query.value */
  #define MASK_QUERY_UPIU_FLAG_LOC 0xFF

 @@ -182,13 +185,35 @@ ufshcd_get_tmr_ocs(struct utp_task_req_desc 
 *task_req_descp)
  /**
   * ufshcd_get_tm_free_slot - get a free slot for task management request
   * @hba: per adapter instance
 + * @free_slot: pointer to variable with available slot value
   *
 - * Returns maximum number of task management request slots in case of
 - * task management queue full or returns the free slot number
 + * Get a free tag and lock it until ufshcd_put_tm_slot() is called.
 + * Returns 0 if free slot is not available, else return 1 with tag value
 + * in @free_slot.
   */
 -static inline int ufshcd_get_tm_free_slot(struct ufs_hba *hba)
 +static bool ufshcd_get_tm_free_slot(struct ufs_hba *hba, int *free_slot)
  {
 -   return find_first_zero_bit(hba-outstanding_tasks, hba-nutmrs);
 +   int tag;
 +   bool ret = false;
 +
 +   if (!free_slot)
 +   goto out;
 +
 +   do {
 +   tag = find_first_zero_bit(hba-tm_slots_in_use, hba-nutmrs);
 +   if (tag = hba-nutmrs)
 +   goto out;
 +   } while (test_and_set_bit_lock(tag, hba-tm_slots_in_use));
 +
 +   *free_slot = tag;
 +   ret = true;
 +out:
 +   return ret;
 +}
 +
 +static inline void ufshcd_put_tm_slot(struct ufs_hba *hba, int slot)
 +{
 +   clear_bit_unlock(slot, hba-tm_slots_in_use);
  }

  /**
 @@ -1912,10 +1937,11 @@ static void ufshcd_slave_destroy(struct scsi_device 
 *sdev)
   * ufshcd_task_req_compl - handle task management request completion
   * @hba: per adapter instance
   * @index: index of the completed request
 + * @resp: task management service response
   *
 - * Returns SUCCESS/FAILED
 + * Returns non-zero value on error, zero on success
   */
 -static int ufshcd_task_req_compl(struct ufs_hba *hba, u32 index)
 +static int ufshcd_task_req_compl(struct ufs_hba *hba, u32 index, u8 *resp)
  {
 struct utp_task_req_desc *task_req_descp;
 struct utp_upiu_task_rsp *task_rsp_upiup;
 @@ -1936,19 +1962,15 @@ static int ufshcd_task_req_compl(struct ufs_hba *hba, 
 u32 index)
 task_req_descp[index].task_rsp_upiu;
 task_result = be32_to_cpu(task_rsp_upiup-header.dword_1);
 task_result = ((task_result  MASK_TASK_RESPONSE)  8);
 -
 -   if (task_result != UPIU_TASK_MANAGEMENT_FUNC_COMPL 
 -   task_result != UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED)
 -   task_result = FAILED;
 -   else
 -   task_result = SUCCESS;
 +   if (resp)
 +   *resp = (u8)task_result;
 } else {
 -   task_result = FAILED;
 -   dev_err(hba-dev,
 -   trc: Invalid ocs = %x\n, ocs_value);
 +   dev_err(hba-dev, %s: failed, ocs = 0x%x\n,
 +   __func__, ocs_value);
 }
 

Re: [PATCH V7 5/6] scsi: ufs: Fix device and host reset methods

2013-09-23 Thread vinayak holikatti
On Thu, Sep 19, 2013 at 4:44 PM, Sujit Reddy Thumma
sthu...@codeaurora.org wrote:
 As of now SCSI initiated error handling is broken because,
 the reset APIs don't try to bring back the device initialized and
 ready for further transfers.

 In case of timeouts, the scsi error handler takes care of handling aborts
 and resets. Improve the error handling in such scenario by resetting the
 device and host and re-initializing them in proper manner.

 Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
 Reviewed-by: Yaniv Gardi yga...@codeaurora.org
 Tested-by: Dolev Raviv dra...@codeaurora.org
 ---
  drivers/scsi/ufs/ufshcd.c | 240 
 --
  drivers/scsi/ufs/ufshcd.h |   2 +
  2 files changed, 189 insertions(+), 53 deletions(-)

 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
 index 52f66e4..5462310 100644
 --- a/drivers/scsi/ufs/ufshcd.c
 +++ b/drivers/scsi/ufs/ufshcd.c
 @@ -74,9 +74,14 @@ enum {

  /* UFSHCD states */
  enum {
 -   UFSHCD_STATE_OPERATIONAL,
 UFSHCD_STATE_RESET,
 UFSHCD_STATE_ERROR,
 +   UFSHCD_STATE_OPERATIONAL,
 +};
 +
 +/* UFSHCD error handling flags */
 +enum {
 +   UFSHCD_EH_IN_PROGRESS = (1  0),
  };

  /* Interrupt configuration options */
 @@ -86,6 +91,16 @@ enum {
 UFSHCD_INT_CLEAR,
  };

 +#define ufshcd_set_eh_in_progress(h) \
 +   (h-eh_flags |= UFSHCD_EH_IN_PROGRESS)
 +#define ufshcd_eh_in_progress(h) \
 +   (h-eh_flags  UFSHCD_EH_IN_PROGRESS)
 +#define ufshcd_clear_eh_in_progress(h) \
 +   (h-eh_flags = ~UFSHCD_EH_IN_PROGRESS)
 +
 +static void ufshcd_tmc_handler(struct ufs_hba *hba);
 +static void ufshcd_async_scan(void *data, async_cookie_t cookie);
 +
  /*
   * ufshcd_wait_for_register - wait for register value to change
   * @hba - per-adapter interface
 @@ -856,10 +871,25 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, 
 struct scsi_cmnd *cmd)

 tag = cmd-request-tag;

 -   if (hba-ufshcd_state != UFSHCD_STATE_OPERATIONAL) {
 +   spin_lock_irqsave(hba-host-host_lock, flags);
 +   switch (hba-ufshcd_state) {
 +   case UFSHCD_STATE_OPERATIONAL:
 +   break;
 +   case UFSHCD_STATE_RESET:
 err = SCSI_MLQUEUE_HOST_BUSY;
 -   goto out;
 +   goto out_unlock;
 +   case UFSHCD_STATE_ERROR:
 +   set_host_byte(cmd, DID_ERROR);
 +   cmd-scsi_done(cmd);
 +   goto out_unlock;
 +   default:
 +   dev_WARN_ONCE(hba-dev, 1, %s: invalid state %d\n,
 +   __func__, hba-ufshcd_state);
 +   set_host_byte(cmd, DID_BAD_TARGET);
 +   cmd-scsi_done(cmd);
 +   goto out_unlock;
 }
 +   spin_unlock_irqrestore(hba-host-host_lock, flags);

 /* acquire the tag to make sure device cmds don't use it */
 if (test_and_set_bit_lock(tag, hba-lrb_in_use)) {
 @@ -896,6 +926,7 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, 
 struct scsi_cmnd *cmd)
 /* issue command to the controller */
 spin_lock_irqsave(hba-host-host_lock, flags);
 ufshcd_send_command(hba, tag);
 +out_unlock:
 spin_unlock_irqrestore(hba-host-host_lock, flags);
  out:
 return err;
 @@ -1707,8 +1738,6 @@ static int ufshcd_make_hba_operational(struct ufs_hba 
 *hba)
 if (hba-ufshcd_state == UFSHCD_STATE_RESET)
 scsi_unblock_requests(hba-host);

 -   hba-ufshcd_state = UFSHCD_STATE_OPERATIONAL;
 -
  out:
 return err;
  }
 @@ -2455,8 +2484,12 @@ static void ufshcd_err_handler(struct ufs_hba *hba)
 }
 return;
  fatal_eh:
 -   hba-ufshcd_state = UFSHCD_STATE_ERROR;
 -   schedule_work(hba-feh_workq);
 +   /* handle fatal errors only when link is functional */
 +   if (hba-ufshcd_state == UFSHCD_STATE_OPERATIONAL) {
 +   /* block commands at driver layer until error is handled */
 +   hba-ufshcd_state = UFSHCD_STATE_ERROR;
 +   schedule_work(hba-feh_workq);
 +   }
  }

  /**
 @@ -2621,12 +2654,13 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, 
 int lun_id, int task_id,
  }

  /**
 - * ufshcd_device_reset - reset device and abort all the pending commands
 + * ufshcd_eh_device_reset_handler - device reset handler registered to
 + *scsi layer.
   * @cmd: SCSI command pointer
   *
   * Returns SUCCESS/FAILED
   */
 -static int ufshcd_device_reset(struct scsi_cmnd *cmd)
 +static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd)
  {
 struct Scsi_Host *host;
 struct ufs_hba *hba;
 @@ -2635,6 +2669,7 @@ static int ufshcd_device_reset(struct scsi_cmnd *cmd)
 int err;
 u8 resp = 0xF;
 struct ufshcd_lrb *lrbp;
 +   unsigned long flags;

 host = cmd-device-host;
 hba = shost_priv(host);
 @@ -2643,55 +2678,33 @@ static int ufshcd_device_reset(struct scsi_cmnd 

Re: [PATCH V7 6/6] scsi: ufs: Improve UFS fatal error handling

2013-09-23 Thread vinayak holikatti
On Thu, Sep 19, 2013 at 4:44 PM, Sujit Reddy Thumma
sthu...@codeaurora.org wrote:
 Error handling in UFS driver is broken and resets the host controller
 for fatal errors without re-initialization. Correct the fatal error
 handling sequence according to UFS Host Controller Interface (HCI)
 v1.1 specification.

 o Processed requests which are completed w/wo error are reported to
   SCSI layer and any pending commands that are not started are aborted
   in the controller and re-queued into scsi mid-layer queue.

 o Upon determining fatal error condition the host controller may hang
   forever until a reset is applied. Block SCSI layer for sending new
   requests and apply reset in a separate error handling work.

 o SCSI is informed about the expected Unit-Attention exception from the
   device for the immediate command after a reset so that the SCSI layer
   take necessary steps to establish communication with the device.

 Signed-off-by: Sujit Reddy Thumma sthu...@codeaurora.org
 Reviewed-by: Yaniv Gardi yga...@codeaurora.org
 Tested-by: Dolev Raviv dra...@codeaurora.org
 ---
  drivers/scsi/ufs/ufshcd.c | 229 
 --
  drivers/scsi/ufs/ufshcd.h |  10 +-
  2 files changed, 149 insertions(+), 90 deletions(-)

 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
 index 5462310..0c28772 100644
 --- a/drivers/scsi/ufs/ufshcd.c
 +++ b/drivers/scsi/ufs/ufshcd.c
 @@ -84,6 +84,14 @@ enum {
 UFSHCD_EH_IN_PROGRESS = (1  0),
  };

 +/* UFSHCD UIC layer error flags */
 +enum {
 +   UFSHCD_UIC_DL_PA_INIT_ERROR = (1  0), /* Data link layer error */
 +   UFSHCD_UIC_NL_ERROR = (1  1), /* Network layer error */
 +   UFSHCD_UIC_TL_ERROR = (1  2), /* Transport Layer error */
 +   UFSHCD_UIC_DME_ERROR = (1  3), /* DME error */
 +};
 +
  /* Interrupt configuration options */
  enum {
 UFSHCD_INT_DISABLE,
 @@ -100,6 +108,8 @@ enum {

  static void ufshcd_tmc_handler(struct ufs_hba *hba);
  static void ufshcd_async_scan(void *data, async_cookie_t cookie);
 +static int ufshcd_reset_and_restore(struct ufs_hba *hba);
 +static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag);

  /*
   * ufshcd_wait_for_register - wait for register value to change
 @@ -1735,9 +1745,6 @@ static int ufshcd_make_hba_operational(struct ufs_hba 
 *hba)
 goto out;
 }

 -   if (hba-ufshcd_state == UFSHCD_STATE_RESET)
 -   scsi_unblock_requests(hba-host);
 -
  out:
 return err;
  }
 @@ -1863,66 +1870,6 @@ static int ufshcd_verify_dev_init(struct ufs_hba *hba)
  }

  /**
 - * ufshcd_do_reset - reset the host controller
 - * @hba: per adapter instance
 - *
 - * Returns SUCCESS/FAILED
 - */
 -static int ufshcd_do_reset(struct ufs_hba *hba)
 -{
 -   struct ufshcd_lrb *lrbp;
 -   unsigned long flags;
 -   int tag;
 -
 -   /* block commands from midlayer */
 -   scsi_block_requests(hba-host);
 -
 -   spin_lock_irqsave(hba-host-host_lock, flags);
 -   hba-ufshcd_state = UFSHCD_STATE_RESET;
 -
 -   /* send controller to reset state */
 -   ufshcd_hba_stop(hba);
 -   spin_unlock_irqrestore(hba-host-host_lock, flags);
 -
 -   /* abort outstanding commands */
 -   for (tag = 0; tag  hba-nutrs; tag++) {
 -   if (test_bit(tag, hba-outstanding_reqs)) {
 -   lrbp = hba-lrb[tag];
 -   if (lrbp-cmd) {
 -   scsi_dma_unmap(lrbp-cmd);
 -   lrbp-cmd-result = DID_RESET  16;
 -   lrbp-cmd-scsi_done(lrbp-cmd);
 -   lrbp-cmd = NULL;
 -   clear_bit_unlock(tag, hba-lrb_in_use);
 -   }
 -   }
 -   }
 -
 -   /* complete device management command */
 -   if (hba-dev_cmd.complete)
 -   complete(hba-dev_cmd.complete);
 -
 -   /* clear outstanding request/task bit maps */
 -   hba-outstanding_reqs = 0;
 -   hba-outstanding_tasks = 0;
 -
 -   /* Host controller enable */
 -   if (ufshcd_hba_enable(hba)) {
 -   dev_err(hba-dev,
 -   Reset: Controller initialization failed\n);
 -   return FAILED;
 -   }
 -
 -   if (ufshcd_link_startup(hba)) {
 -   dev_err(hba-dev,
 -   Reset: Link start-up failed\n);
 -   return FAILED;
 -   }
 -
 -   return SUCCESS;
 -}
 -
 -/**
   * ufshcd_slave_alloc - handle initial SCSI device configurations
   * @sdev: pointer to SCSI device
   *
 @@ -1939,6 +1886,9 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
 sdev-use_10_for_ms = 1;
 scsi_set_tag_type(sdev, MSG_SIMPLE_TAG);

 +   /* allow SCSI layer to restart the device in case of errors */
 +   sdev-allow_restart = 1;
 +
 /*
  * Inform SCSI Midlayer that the LUN queue depth is same as the
  * controller 

Re: [PATCH v4 1/3] usb: dwc3: msm: Add device tree binding information

2013-09-23 Thread Felipe Balbi
Hi,

On Tue, Aug 20, 2013 at 12:56:03PM +0300, Ivan T. Ivanov wrote:
 From: Ivan T. Ivanov iiva...@mm-sol.com
 
 MSM USB3.0 core wrapper consist of USB3.0 IP from Synopsys
 (SNPS) and HS, SS PHY's control and configuration registers.
 
 It could operate in device mode (SS, HS, FS) and host
 mode (SS, HS, FS, LS).
 
 Signed-off-by: Ivan T. Ivanov iiva...@mm-sol.com

Any acks for the DT part ? This patch has been pending forever.

 ---
  .../devicetree/bindings/usb/msm-ssusb.txt  |  104 
 
  1 file changed, 104 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/usb/msm-ssusb.txt
 
 diff --git a/Documentation/devicetree/bindings/usb/msm-ssusb.txt 
 b/Documentation/devicetree/bindings/usb/msm-ssusb.txt
 new file mode 100644
 index 000..cacbd3b
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/msm-ssusb.txt
 @@ -0,0 +1,104 @@
 +MSM SuperSpeed DWC3 USB SoC controller
 +
 +
 +DWC3 Highspeed USB PHY
 +==
 +Required properities :
 +- compatible : sould be qcom,dwc3-hsphy;
 +- reg : offset and length of the register set in the memory map
 +- clocks : phandles to clock instances of the device tree nodes
 +- clock-names :
 + xo : External reference clock 19 MHz
 + sleep_a : Sleep clock, used when USB3 core goes into low
 + power mode (U3).
 +supply-name-supply : phandle to the regulator device tree node
 +Required supply-name are:
 + v1p8 : 1.8v supply for HSPHY
 + v3p3 : 3.3v supply for HSPHY
 + vbus : vbus supply for host mode
 + vddcx : vdd supply for HS-PHY digital circuit operation
 +
 +DWC3 Superspeed USB PHY
 +===
 +Required properities :
 +- compatible : sould be qcom,dwc3-ssphy;
 +- reg : offset and length of the register set in the memory map
 +- clocks : phandles to clock instances of the device tree nodes
 +- clock-names :
 + xo : External reference clock 19 MHz
 + ref : Reference clock - used in host mode.
 +supply-name-supply : phandle to the regulator device tree node
 +Required supply-name are:
 + v1p8 : 1.8v supply for SS-PHY
 + vddcx : vdd supply for SS-PHY digital circuit operation
 +
 +DWC3 controller wrapper
 +===
 +Required properties :
 +- compatible : should be qcom,dwc3
 +- reg : offset and length of the register set in the memory map
 + offset and length of the TCSR register for routing USB
 + signals to either picoPHY0 or picoPHY1.
 +- clocks : phandles to clock instances of the device tree nodes
 +- clock-names :
 + core : Master/Core clock, have to be = 125 MHz for SS
 + operation and = 60MHz for HS operation
 + iface : System bus AXI clock
 + sleep : Sleep clock, used when USB3 core goes into low
 + power mode (U3).
 + utmi : Generated by HS-PHY. Used to clock the low power
 + parts of thr HS Link layer.
 +Optional properties :
 +- gdsc-supply : phandle to the globally distributed switch controller
 +  regulator node to the USB controller.
 +Required child node:
 +A child node must exist to represent the core DWC3 IP block. The name of
 +the node is not important. The content of the node is defined in dwc3.txt.
 +
 +Example device nodes:
 +
 + dwc3_hsphy: phy@f92f8800 {
 + compatible = qcom,dwc3-hsphy;
 + reg = 0xf92f8800 0x30;
 +
 + clocks = cxo, usb2a_phy_sleep_cxc;
 + clock-names = xo, sleep_a;
 +
 + vbus-supply = supply;
 + vddcx-supply = supply;
 + v1p8-supply = supply;
 + v3p3-supply = supply;
 + };
 +
 + dwc3_ssphy: phy@f92f8830 {
 + compatible = qcom,dwc3-ssphy;
 + reg = 0xf92f8830 0x30;
 +
 + clocks = cxo, usb30_mock_utmi_cxc;
 + clock-names = xo, ref;
 +
 + vddcx-supply = supply;
 + v1p8-supply = supply;
 + };
 +
 + usb@fd4ab000 {
 + compatible = qcom,dwc3;
 + #address-cells = 1;
 + #size-cells = 1;
 + reg = 0xfd4ab000 0x4;
 +
 + clocks = usb30_master_cxc, sys_noc_usb3_axi_cxc,
 + usb30_sleep_cxc, usb30_mock_utmi_cxc;
 + clock-names = core, iface, sleep, utmi;
 +
 + gdsc-supply = supply;
 +
 + ranges;
 + dwc3@f920 {
 + compatible = snps,dwc3;
 + reg = 0xf920 0xcd00;
 + interrupts = 0 131 0;
 + usb-phy = dwc3_hsphy, dwc3_ssphy;
 + tx-fifo-resize;
 + };
 + };
 -- 
 1.7.9.5
 

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v5 1/3] usb: dwc3: msm: Add device tree binding information

2013-09-23 Thread Felipe Balbi
Hi,

On Wed, Aug 21, 2013 at 04:29:44PM +0300, Ivan T. Ivanov wrote:
 From: Ivan T. Ivanov iiva...@mm-sol.com
 
 MSM USB3.0 core wrapper consist of USB3.0 IP from Synopsys
 (SNPS) and HS, SS PHY's control and configuration registers.
 
 It could operate in device mode (SS, HS, FS) and host
 mode (SS, HS, FS, LS).
 
 Signed-off-by: Ivan T. Ivanov iiva...@mm-sol.com

and here's a new version from same patch

 ---
  .../devicetree/bindings/usb/msm-ssusb.txt  |  104 
 
  1 file changed, 104 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/usb/msm-ssusb.txt
 
 diff --git a/Documentation/devicetree/bindings/usb/msm-ssusb.txt 
 b/Documentation/devicetree/bindings/usb/msm-ssusb.txt
 new file mode 100644
 index 000..f57ba8d
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/msm-ssusb.txt
 @@ -0,0 +1,104 @@
 +MSM SuperSpeed DWC3 USB SoC controller
 +
 +
 +MSM DW Highspeed USB PHY
 +
 +Required properities :
 +- compatible : sould be qcom,dw-hsphy;
 +- reg : offset and length of the register set in the memory map
 +- clocks : phandles to clock instances of the device tree nodes
 +- clock-names :
 + xo : External reference clock 19 MHz
 + sleep_a : Sleep clock, used when USB3 core goes into low
 + power mode (U3).
 +supply-name-supply : phandle to the regulator device tree node
 +Required supply-name are:
 + v1p8 : 1.8v supply for HSPHY
 + v3p3 : 3.3v supply for HSPHY
 + vbus : vbus supply for host mode
 + vddcx : vdd supply for HS-PHY digital circuit operation
 +
 +MSM DW Superspeed USB PHY
 +=
 +Required properities :
 +- compatible : sould be qcom,dw-ssphy;
 +- reg : offset and length of the register set in the memory map
 +- clocks : phandles to clock instances of the device tree nodes
 +- clock-names :
 + xo : External reference clock 19 MHz
 + ref : Reference clock - used in host mode.
 +supply-name-supply : phandle to the regulator device tree node
 +Required supply-name are:
 + v1p8 : 1.8v supply for SS-PHY
 + vddcx : vdd supply for SS-PHY digital circuit operation
 +
 +MSM DWC3 controller wrapper
 +===
 +Required properties :
 +- compatible : should be qcom,dwc3
 +- reg : offset and length of the register set in the memory map
 + offset and length of the TCSR register for routing USB
 + signals to either picoPHY0 or picoPHY1.
 +- clocks : phandles to clock instances of the device tree nodes
 +- clock-names :
 + core : Master/Core clock, have to be = 125 MHz for SS
 + operation and = 60MHz for HS operation
 + iface : System bus AXI clock
 + sleep : Sleep clock, used when USB3 core goes into low
 + power mode (U3).
 + utmi : Generated by HS-PHY. Used to clock the low power
 + parts of thr HS Link layer.
 +Optional properties :
 +- gdsc-supply : phandle to the globally distributed switch controller
 +  regulator node to the USB controller.
 +Required child node:
 +A child node must exist to represent the core DWC3 IP block. The name of
 +the node is not important. The content of the node is defined in dwc3.txt.
 +
 +Example device nodes:
 +
 + dw_hsphy: phy@f92f8800 {
 + compatible = qcom,dw-hsphy;
 + reg = 0xf92f8800 0x30;
 +
 + clocks = cxo, usb2a_phy_sleep_cxc;
 + clock-names = xo, sleep_a;
 +
 + vbus-supply = supply;
 + vddcx-supply = supply;
 + v1p8-supply = supply;
 + v3p3-supply = supply;
 + };
 +
 + dw_ssphy: phy@f92f8830 {
 + compatible = qcom,dw-ssphy;
 + reg = 0xf92f8830 0x30;
 +
 + clocks = cxo, usb30_mock_utmi_cxc;
 + clock-names = xo, ref;
 +
 + vddcx-supply = supply;
 + v1p8-supply = supply;
 + };
 +
 + usb@fd4ab000 {
 + compatible = qcom,dwc3;
 + #address-cells = 1;
 + #size-cells = 1;
 + reg = 0xfd4ab000 0x4;
 +
 + clocks = usb30_master_cxc, sys_noc_usb3_axi_cxc,
 + usb30_sleep_cxc, usb30_mock_utmi_cxc;
 + clock-names = core, iface, sleep, utmi;
 +
 + gdsc-supply = supply;
 +
 + ranges;
 + dwc3@f920 {
 + compatible = snps,dwc3;
 + reg = 0xf920 0xcd00;
 + interrupts = 0 131 0;
 + usb-phy = dw_hsphy, dw_ssphy;
 + tx-fifo-resize;
 + };
 + };
 -- 
 1.7.9.5
 

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v5 2/3] usb: phy: Add Qualcomm SS-USB and HS-USB drivers for DW PHY's

2013-09-23 Thread Felipe Balbi
Hi,

On Wed, Aug 21, 2013 at 04:29:45PM +0300, Ivan T. Ivanov wrote:
 From: Ivan T. Ivanov iiva...@mm-sol.com
 
 These drivers handles control and configuration of the HS
 and SS USB PHY transceivers. They are part of the driver
 which manage Synopsys DesignWare USB3 controller stack
 inside Qualcomm SoC's.
 
 Signed-off-by: Ivan T. Ivanov iiva...@mm-sol.com

I can take this one if DT folks agree with bindings proposed on previous
patch.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v5 1/3] usb: dwc3: msm: Add device tree binding information

2013-09-23 Thread Stephen Warren
On 09/23/2013 01:32 PM, Felipe Balbi wrote:
 Hi,
 
 On Wed, Aug 21, 2013 at 04:29:44PM +0300, Ivan T. Ivanov wrote:
 From: Ivan T. Ivanov iiva...@mm-sol.com
 
 MSM USB3.0 core wrapper consist of USB3.0 IP from Synopsys (SNPS)
 and HS, SS PHY's control and configuration registers.
 
 It could operate in device mode (SS, HS, FS) and host mode (SS,
 HS, FS, LS).
 
 Signed-off-by: Ivan T. Ivanov iiva...@mm-sol.com
 
 and here's a new version from same patch

The binding looks pretty simple, so I don't think it's too contentious.

 diff --git a/Documentation/devicetree/bindings/usb/msm-ssusb.txt
 b/Documentation/devicetree/bindings/usb/msm-ssusb.txt

 +MSM DWC3 controller wrapper

 +Optional properties : +- gdsc-supply : phandle to the globally
 distributed switch controller +  regulator node to the USB
 controller.

If that's a regulator node, why not use xxx-supply properties to
interface with it?

Aside from that, the binding,
Acked-by: Stephen Warren swar...@nvidia.com
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[no subject]

2013-09-23 Thread Rohit Vaswani
Date: Mon, 23 Sep 2013 19:51:25 -0700
Subject: [PATCH 1/3] ARM: debug: Create CONFIG_DEBUG_MSM_UART and re-organize
 the selects for MSM

Create the hidden config DEBUG_MSM_UART and clean-up the default selection
for CONFIG_DEBUG_LL_INCLUDE.

Signed-off-by: Rohit Vaswani rvasw...@codeaurora.org
---
 arch/arm/Kconfig.debug | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 9762c84..e18a6fc 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -318,6 +318,7 @@ choice
config DEBUG_MSM_UART1
bool Kernel low-level debugging messages via MSM UART1
depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the first serial port on MSM devices.
@@ -325,6 +326,7 @@ choice
config DEBUG_MSM_UART2
bool Kernel low-level debugging messages via MSM UART2
depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the second serial port on MSM devices.
@@ -332,6 +334,7 @@ choice
config DEBUG_MSM_UART3
bool Kernel low-level debugging messages via MSM UART3
depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the third serial port on MSM devices.
@@ -340,6 +343,7 @@ choice
bool Kernel low-level debugging messages via MSM 8660 UART
depends on ARCH_MSM8X60
select MSM_HAS_DEBUG_UART_HS
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the serial port on MSM 8660 devices.
@@ -348,6 +352,7 @@ choice
bool Kernel low-level debugging messages via MSM 8960 UART
depends on ARCH_MSM8960
select MSM_HAS_DEBUG_UART_HS
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the serial port on MSM 8960 devices.
@@ -880,6 +885,10 @@ config DEBUG_STI_UART
bool
depends on ARCH_STI
 
+config DEBUG_MSM_UART
+   bool
+   depends on ARCH_MSM
+
 config DEBUG_LL_INCLUDE
string
default debug/8250.S if DEBUG_LL_UART_8250 || DEBUG_UART_8250
@@ -895,11 +904,7 @@ config DEBUG_LL_INCLUDE
 DEBUG_IMX53_UART ||\
 DEBUG_IMX6Q_UART || \
 DEBUG_IMX6SL_UART
-   default debug/msm.S if DEBUG_MSM_UART1 || \
-DEBUG_MSM_UART2 || \
-DEBUG_MSM_UART3 || \
-DEBUG_MSM8660_UART || \
-DEBUG_MSM8960_UART
+   default debug/msm.S if DEBUG_MSM_UART
default debug/omap2plus.S if DEBUG_OMAP2PLUS_UART
default debug/sirf.S if DEBUG_SIRFPRIMA2_UART1 || 
DEBUG_SIRFMARCO_UART1
default debug/sti.S if DEBUG_STI_UART
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv4 2/3] ARM: msm: Add support for APQ8074 Dragonboard

2013-09-23 Thread Rohit Vaswani
This patch adds basic board support for APQ8074 Dragonboard
which belongs to the Snapdragon 800 family.
For now, just support a basic machine with device tree.

Signed-off-by: Rohit Vaswani rvasw...@codeaurora.org
---
 arch/arm/Kconfig.debug |  9 +++
 arch/arm/boot/dts/Makefile |  3 ++-
 arch/arm/boot/dts/qcom-apq8074-dragonboard.dts |  6 +
 arch/arm/boot/dts/qcom-msm8974.dtsi| 35 ++
 arch/arm/include/debug/msm.S   |  5 
 arch/arm/mach-msm/Kconfig  | 13 ++
 arch/arm/mach-msm/board-dt.c   |  9 +++
 7 files changed, 79 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
 create mode 100644 arch/arm/boot/dts/qcom-msm8974.dtsi

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index e18a6fc..959b2c7 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -357,6 +357,15 @@ choice
  Say Y here if you want the debug print routines to direct
  their output to the serial port on MSM 8960 devices.
 
+   config DEBUG_MSM8974_UART
+   bool Kernel low-level debugging messages via MSM 8974 UART
+   depends on ARCH_MSM8974
+   select MSM_HAS_DEBUG_UART_HS
+   select DEBUG_MSM_UART
+   help
+ Say Y here if you want the debug print routines to direct
+ their output to the serial port on MSM 8974 devices.
+
config DEBUG_MVEBU_UART
bool Kernel low-level debugging messages via MVEBU UART (old 
bootloaders)
depends on ARCH_MVEBU
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 000cf76..e71a3ec 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -102,7 +102,8 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
kirkwood-openblocks_a6.dtb
 dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
 dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
-   msm8960-cdp.dtb
+   msm8960-cdp.dtb \
+   qcom-apq8074-dragonboard.dtb
 dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
armada-370-mirabox.dtb \
armada-370-netgear-rn102.dtb \
diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts 
b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
new file mode 100644
index 000..bb6f3c4
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
@@ -0,0 +1,6 @@
+/include/ qcom-msm8974.dtsi
+
+/ {
+   model = Qualcomm APQ8074 Dragonboard;
+   compatible = qcom,apq8074-dragonboard, qcom,apq8074;
+};
diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi 
b/arch/arm/boot/dts/qcom-msm8974.dtsi
new file mode 100644
index 000..f04b643
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
@@ -0,0 +1,35 @@
+/dts-v1/;
+
+/include/ skeleton.dtsi
+
+/ {
+   model = Qualcomm MSM8974;
+   compatible = qcom,msm8974;
+   interrupt-parent = intc;
+
+   soc: soc { };
+};
+
+soc {
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+   compatible = simple-bus;
+
+   intc: interrupt-controller@f900 {
+   compatible = qcom,msm-qgic2;
+   interrupt-controller;
+   #interrupt-cells = 3;
+   reg = 0xf900 0x1000,
+ 0xf9002000 0x1000;
+   };
+
+   timer {
+   compatible = arm,armv7-timer;
+   interrupts = 1 2 0xf08,
+1 3 0xf08,
+1 4 0xf08,
+1 1 0xf08;
+   clock-frequency = 1920;
+   };
+};
diff --git a/arch/arm/include/debug/msm.S b/arch/arm/include/debug/msm.S
index 9166e1b..9d653d4 100644
--- a/arch/arm/include/debug/msm.S
+++ b/arch/arm/include/debug/msm.S
@@ -46,6 +46,11 @@
 #define MSM_DEBUG_UART_PHYS0x1644
 #endif
 
+#ifdef CONFIG_DEBUG_MSM8974_UART
+#define MSM_DEBUG_UART_BASE0xFA71E000
+#define MSM_DEBUG_UART_PHYS0xF991E000
+#endif
+
.macro  addruart, rp, rv, tmp
 #ifdef MSM_DEBUG_UART_PHYS
ldr \rp, =MSM_DEBUG_UART_PHYS
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 2586c28..086bcb9 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -64,6 +64,19 @@ config ARCH_MSM_DT
select SPARSE_IRQ
select USE_OF
 
+config ARCH_MSM8974
+   bool MSM8974
+   select ARM_GIC
+   select CPU_V7
+   select HAVE_ARM_ARCH_TIMER
+   select HAVE_SMP
+   select MSM_SCM if SMP
+   select USE_OF
+
+config ARCH_MSM_DT
+   def_bool y
+   depends on (ARCH_MSM8X60 || ARCH_MSM8960 || ARCH_MSM8974)
+
 config MSM_HAS_DEBUG_UART_HS
bool
 
diff --git a/arch/arm/mach-msm/board-dt.c b/arch/arm/mach-msm/board-dt.c
index 266a280..5211e80 100644
--- a/arch/arm/mach-msm/board-dt.c
+++ b/arch/arm/mach-msm/board-dt.c
@@ -26,7 +26,16 @@ static 

[PATCH 3/3] defconfig: msm_defconfig: Enable CONFIG_ARCH_MSM8974

2013-09-23 Thread Rohit Vaswani
This patch enables MSM8974 build support.

Signed-off-by: Rohit Vaswani rvasw...@codeaurora.org
---
 arch/arm/configs/msm_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
index 690b5f9..0ed32e5 100644
--- a/arch/arm/configs/msm_defconfig
+++ b/arch/arm/configs/msm_defconfig
@@ -20,6 +20,7 @@ CONFIG_PARTITION_ADVANCED=y
 CONFIG_ARCH_MSM=y
 CONFIG_ARCH_MSM8X60=y
 CONFIG_ARCH_MSM8960=y
+CONFIG_ARCH_MSM8974=y
 CONFIG_SMP=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] ARM: debug: Create CONFIG_DEBUG_MSM_UART and re-organize the selects for MSM

2013-09-23 Thread Rohit Vaswani
Create the hidden config DEBUG_MSM_UART and clean-up the default selection
for CONFIG_DEBUG_LL_INCLUDE.

Signed-off-by: Rohit Vaswani rvasw...@codeaurora.org
---
 arch/arm/Kconfig.debug | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 9762c84..e18a6fc 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -318,6 +318,7 @@ choice
config DEBUG_MSM_UART1
bool Kernel low-level debugging messages via MSM UART1
depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the first serial port on MSM devices.
@@ -325,6 +326,7 @@ choice
config DEBUG_MSM_UART2
bool Kernel low-level debugging messages via MSM UART2
depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the second serial port on MSM devices.
@@ -332,6 +334,7 @@ choice
config DEBUG_MSM_UART3
bool Kernel low-level debugging messages via MSM UART3
depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the third serial port on MSM devices.
@@ -340,6 +343,7 @@ choice
bool Kernel low-level debugging messages via MSM 8660 UART
depends on ARCH_MSM8X60
select MSM_HAS_DEBUG_UART_HS
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the serial port on MSM 8660 devices.
@@ -348,6 +352,7 @@ choice
bool Kernel low-level debugging messages via MSM 8960 UART
depends on ARCH_MSM8960
select MSM_HAS_DEBUG_UART_HS
+   select DEBUG_MSM_UART
help
  Say Y here if you want the debug print routines to direct
  their output to the serial port on MSM 8960 devices.
@@ -880,6 +885,10 @@ config DEBUG_STI_UART
bool
depends on ARCH_STI
 
+config DEBUG_MSM_UART
+   bool
+   depends on ARCH_MSM
+
 config DEBUG_LL_INCLUDE
string
default debug/8250.S if DEBUG_LL_UART_8250 || DEBUG_UART_8250
@@ -895,11 +904,7 @@ config DEBUG_LL_INCLUDE
 DEBUG_IMX53_UART ||\
 DEBUG_IMX6Q_UART || \
 DEBUG_IMX6SL_UART
-   default debug/msm.S if DEBUG_MSM_UART1 || \
-DEBUG_MSM_UART2 || \
-DEBUG_MSM_UART3 || \
-DEBUG_MSM8660_UART || \
-DEBUG_MSM8960_UART
+   default debug/msm.S if DEBUG_MSM_UART
default debug/omap2plus.S if DEBUG_OMAP2PLUS_UART
default debug/sirf.S if DEBUG_SIRFPRIMA2_UART1 || 
DEBUG_SIRFMARCO_UART1
default debug/sti.S if DEBUG_STI_UART
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html