All of lore.kernel.org
 help / color / mirror / Atom feed
From: merez@codeaurora.org
To: Seungwon Jeon <tgih.jun@samsung.com>
Cc: linux-scsi@vger.kernel.org,
	'Vinayak Holikatti' <vinholikatti@gmail.com>,
	'Santosh Y' <santoshsy@gmail.com>,
	"'James E.J. Bottomley'" <jbottomley@parallels.com>
Subject: Re: [PATCH v3 2/6] scsi: ufs: amend interrupt configuration
Date: Mon, 6 May 2013 03:39:48 -0700	[thread overview]
Message-ID: <31bfa33332406cce4bcec3ba68bdba34.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <001201ce4a1b$c3b9f700$4b2de500$%jun@samsung.com>

Hi James,

Can you please merge this patch?

Thanks,
Maya
> It makes interrupt setting more flexible especially
> for disabling. And wrong bit mask is fixed for ver 1.0.
> [17:16] is added for mask.
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> Tested-by: Maya Erez <merez@codeaurora.org>
> ---
>  drivers/scsi/ufs/ufshcd.c |   84
> +++++++++++++++++++++++++++++++-------------
>  drivers/scsi/ufs/ufshcd.h |    4 +-
>  drivers/scsi/ufs/ufshci.h |    5 ++-
>  3 files changed, 64 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index cf7c8e4..feaf221 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -35,6 +35,10 @@
>
>  #include "ufshcd.h"
>
> +#define UFSHCD_ENABLE_INTRS	(UTP_TRANSFER_REQ_COMPL |\
> +				 UTP_TASK_REQ_COMPL |\
> +				 UFSHCD_ERROR_MASK)
> +
>  enum {
>  	UFSHCD_MAX_CHANNEL	= 0,
>  	UFSHCD_MAX_ID		= 1,
> @@ -64,6 +68,20 @@ enum {
>  };
>
>  /**
> + * ufshcd_get_intr_mask - Get the interrupt bit mask
> + * @hba - Pointer to adapter instance
> + *
> + * Returns interrupt bit mask per version
> + */
> +static inline u32 ufshcd_get_intr_mask(struct ufs_hba *hba)
> +{
> +	if (hba->ufs_version == UFSHCI_VERSION_10)
> +		return INTERRUPT_MASK_ALL_VER_10;
> +	else
> +		return INTERRUPT_MASK_ALL_VER_11;
> +}
> +
> +/**
>   * ufshcd_get_ufs_version - Get the UFS version supported by the HBA
>   * @hba - Pointer to adapter instance
>   *
> @@ -441,25 +459,45 @@ static int ufshcd_map_sg(struct ufshcd_lrb *lrbp)
>  }
>
>  /**
> - * ufshcd_int_config - enable/disable interrupts
> + * ufshcd_enable_intr - enable interrupts
>   * @hba: per adapter instance
> - * @option: interrupt option
> + * @intrs: interrupt bits
>   */
> -static void ufshcd_int_config(struct ufs_hba *hba, u32 option)
> +static void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs)
>  {
> -	switch (option) {
> -	case UFSHCD_INT_ENABLE:
> -		ufshcd_writel(hba, hba->int_enable_mask, REG_INTERRUPT_ENABLE);
> -		break;
> -	case UFSHCD_INT_DISABLE:
> -		if (hba->ufs_version == UFSHCI_VERSION_10)
> -			ufshcd_writel(hba, INTERRUPT_DISABLE_MASK_10,
> -				      REG_INTERRUPT_ENABLE);
> -		else
> -			ufshcd_writel(hba, INTERRUPT_DISABLE_MASK_11,
> -				      REG_INTERRUPT_ENABLE);
> -		break;
> +	u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
> +
> +	if (hba->ufs_version == UFSHCI_VERSION_10) {
> +		u32 rw;
> +		rw = set & INTERRUPT_MASK_RW_VER_10;
> +		set = rw | ((set ^ intrs) & intrs);
> +	} else {
> +		set |= intrs;
> +	}
> +
> +	ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE);
> +}
> +
> +/**
> + * ufshcd_disable_intr - disable interrupts
> + * @hba: per adapter instance
> + * @intrs: interrupt bits
> + */
> +static void ufshcd_disable_intr(struct ufs_hba *hba, u32 intrs)
> +{
> +	u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
> +
> +	if (hba->ufs_version == UFSHCI_VERSION_10) {
> +		u32 rw;
> +		rw = (set & INTERRUPT_MASK_RW_VER_10) &
> +			~(intrs & INTERRUPT_MASK_RW_VER_10);
> +		set = rw | ((set & intrs) & ~INTERRUPT_MASK_RW_VER_10);
> +
> +	} else {
> +		set &= ~intrs;
>  	}
> +
> +	ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE);
>  }
>
>  /**
> @@ -946,8 +984,7 @@ static int ufshcd_dme_link_startup(struct ufs_hba
> *hba)
>  	uic_cmd->argument3 = 0;
>
>  	/* enable UIC related interrupts */
> -	hba->int_enable_mask |= UIC_COMMAND_COMPL;
> -	ufshcd_int_config(hba, UFSHCD_INT_ENABLE);
> +	ufshcd_enable_intr(hba, UIC_COMMAND_COMPL);
>
>  	/* sending UIC commands to controller */
>  	ufshcd_send_uic_command(hba, uic_cmd);
> @@ -994,13 +1031,7 @@ static int ufshcd_make_hba_operational(struct
> ufs_hba *hba)
>  	}
>
>  	/* Enable required interrupts */
> -	hba->int_enable_mask |= (UTP_TRANSFER_REQ_COMPL |
> -				 UIC_ERROR |
> -				 UTP_TASK_REQ_COMPL |
> -				 DEVICE_FATAL_ERROR |
> -				 CONTROLLER_FATAL_ERROR |
> -				 SYSTEM_BUS_FATAL_ERROR);
> -	ufshcd_int_config(hba, UFSHCD_INT_ENABLE);
> +	ufshcd_enable_intr(hba, UFSHCD_ENABLE_INTRS);
>
>  	/* Configure interrupt aggregation */
>  	ufshcd_config_int_aggr(hba, INT_AGGR_CONFIG);
> @@ -1828,7 +1859,7 @@ static void ufshcd_hba_free(struct ufs_hba *hba)
>  void ufshcd_remove(struct ufs_hba *hba)
>  {
>  	/* disable interrupts */
> -	ufshcd_int_config(hba, UFSHCD_INT_DISABLE);
> +	ufshcd_disable_intr(hba, hba->intr_mask);
>
>  	ufshcd_hba_stop(hba);
>  	ufshcd_hba_free(hba);
> @@ -1886,6 +1917,9 @@ int ufshcd_init(struct device *dev, struct ufs_hba
> **hba_handle,
>  	/* Get UFS version supported by the controller */
>  	hba->ufs_version = ufshcd_get_ufs_version(hba);
>
> +	/* Get Interrupt bit mask per version */
> +	hba->intr_mask = ufshcd_get_intr_mask(hba);
> +
>  	/* Allocate memory for host memory space */
>  	err = ufshcd_memory_alloc(hba);
>  	if (err) {
> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
> index 6429bed..d98e046 100644
> --- a/drivers/scsi/ufs/ufshcd.h
> +++ b/drivers/scsi/ufs/ufshcd.h
> @@ -153,7 +153,7 @@ struct ufs_query {
>   * @ufshcd_tm_wait_queue: wait queue for task management
>   * @tm_condition: condition variable for task management
>   * @ufshcd_state: UFSHCD states
> - * @int_enable_mask: Interrupt Mask Bits
> + * @intr_mask: Interrupt Mask Bits
>   * @uic_workq: Work queue for UIC completion handling
>   * @feh_workq: Work queue for fatal controller error handling
>   * @errors: HBA errors
> @@ -191,7 +191,7 @@ struct ufs_hba {
>  	unsigned long tm_condition;
>
>  	u32 ufshcd_state;
> -	u32 int_enable_mask;
> +	u32 intr_mask;
>
>  	/* Work Queues */
>  	struct work_struct uic_workq;
> diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h
> index 4a86247..f1e1b74 100644
> --- a/drivers/scsi/ufs/ufshci.h
> +++ b/drivers/scsi/ufs/ufshci.h
> @@ -232,10 +232,11 @@ enum {
>  /* Interrupt disable masks */
>  enum {
>  	/* Interrupt disable mask for UFSHCI v1.0 */
> -	INTERRUPT_DISABLE_MASK_10	= 0xFFFF,
> +	INTERRUPT_MASK_ALL_VER_10	= 0x30FFF,
> +	INTERRUPT_MASK_RW_VER_10	= 0x30000,
>
>  	/* Interrupt disable mask for UFSHCI v1.1 */
> -	INTERRUPT_DISABLE_MASK_11	= 0x0,
> +	INTERRUPT_MASK_ALL_VER_11	= 0x31FFF,
>  };
>
>  /*
> --
> 1.7.0.4
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
Maya Erez
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


  reply	other threads:[~2013-05-06 10:39 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 14:14 [PATCH 1/1] scsi: ufs: Add support for sending NOP OUT UPIU Sujit Reddy Thumma
2013-04-24 16:06 ` [PATCH 1/5] scsi: ufs: move the ufshcd_hba_stop to ufshcd.c Seungwon Jeon
2013-04-30 11:17   ` Subhash Jadavani
2013-05-01  7:46     ` merez
2013-05-02  8:11   ` Santosh Y
2013-05-02 13:37     ` Seungwon Jeon
2013-05-02 18:49     ` merez
2013-05-04  8:45   ` [PATCH v2 1/7] " Seungwon Jeon
2013-05-05 11:22     ` merez
2013-05-06  3:05       ` Seungwon Jeon
2013-05-06  5:37     ` [PATCH v3 1/6] scsi: ufs: wrap the i/o access operations Seungwon Jeon
2013-05-06 10:37       ` merez
2013-05-06 19:30       ` Santosh Y
2013-05-07  3:52         ` Seungwon Jeon
2013-05-06  5:37     ` [PATCH v3 2/6] scsi: ufs: amend interrupt configuration Seungwon Jeon
2013-05-06 10:39       ` merez [this message]
2013-05-06  5:37     ` [PATCH v3 3/6] scsi: ufs: fix interrupt status clears Seungwon Jeon
2013-05-06 10:49       ` merez
2013-05-06  5:37     ` [PATCH v3 4/6] scsi: ufs: rework link start-up process Seungwon Jeon
2013-05-06  9:47       ` Sujit Reddy Thumma
2013-05-06 10:36         ` merez
2013-05-06 11:21         ` Seungwon Jeon
2013-05-06 18:15           ` merez
2013-05-06  5:37     ` [PATCH v3 5/6] scsi: ufs: add dme configuration primitives Seungwon Jeon
2013-05-06 19:43       ` Santosh Y
2013-05-06  5:39     ` [PATCH v3 6/6] scsi: ufs: add dme control primitives Seungwon Jeon
2013-05-06 19:51       ` Santosh Y
2013-05-07  3:45         ` Seungwon Jeon
2013-05-08  8:41     ` [PATCH v4 1/6] scsi: ufs: wrap the i/o access operations Seungwon Jeon
2013-05-08 11:58       ` merez
2013-05-08 15:18       ` Santosh Y
2013-05-09  1:59         ` Seungwon Jeon
2013-05-09  3:27           ` Santosh Y
2013-05-09  6:39             ` Seungwon Jeon
2013-05-09  6:52               ` Santosh Y
2013-05-09 14:21                 ` James Bottomley
2013-05-10  1:52                   ` Seungwon Jeon
2013-05-08  8:41     ` [PATCH v4 2/6] scsi: ufs: amend interrupt configuration Seungwon Jeon
2013-05-08 15:19       ` Santosh Y
2013-05-08  8:41     ` [PATCH v4 3/6] scsi: ufs: fix interrupt status clears Seungwon Jeon
2013-05-08 15:19       ` Santosh Y
2013-05-08  8:42     ` [PATCH v4 4/6] scsi: ufs: rework link start-up process Seungwon Jeon
2013-05-08 15:20       ` Santosh Y
2013-05-08  8:42     ` [PATCH v4 5/6] scsi: ufs: add dme configuration primitives Seungwon Jeon
2013-05-09  6:53       ` Santosh Y
2013-05-08  8:43     ` [PATCH v4 6/6] scsi: ufs: add dme control primitives Seungwon Jeon
2013-05-09  6:53       ` Santosh Y
2013-05-10 10:42     ` [PATCH] scsi: ufs: use devres functions for ufshcd Seungwon Jeon
2013-05-10 11:00       ` Seungwon Jeon
2013-05-10 11:05       ` [PATCH resend] " Seungwon Jeon
2013-05-02  7:27 ` [PATCH 1/1] scsi: ufs: Add support for sending NOP OUT UPIU Santosh Y
2013-05-02 11:31   ` Sujit Reddy Thumma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31bfa33332406cce4bcec3ba68bdba34.squirrel@www.codeaurora.org \
    --to=merez@codeaurora.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=santoshsy@gmail.com \
    --cc=tgih.jun@samsung.com \
    --cc=vinholikatti@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.