All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	Dean Luick <dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v4 2/2] staging/rdma/hfi1: set Gen3 half-swing for integrated devices
Date: Mon, 21 Dec 2015 13:48:22 -0800	[thread overview]
Message-ID: <20151221214822.GA13485@kroah.com> (raw)
In-Reply-To: <1448999277-22972-3-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Tue, Dec 01, 2015 at 02:47:57PM -0500, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> From: Dean Luick <dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> Correctly set half-swing for integrated devices.  A0 needs all fields set for
> CcePcieCtrl.  B0 and later only need a few fields set.
> 
> Reviewed-by: Stuart Summers <john.s.summers-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Dean Luick <dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> ---
> Changes from V1:
> 	Add comments concerning the very long names.
> 
> Changes from V2:
> 	Remove PC Macro and define short names to be used in the code.
> 
> Changes from V3:
> 	Use newly defined dd_dev_dbg rather than dd_dev_info
> 
>  drivers/staging/rdma/hfi1/chip_registers.h | 11 ++++
>  drivers/staging/rdma/hfi1/pcie.c           | 82 ++++++++++++++++++++++++++++--
>  2 files changed, 89 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rdma/hfi1/chip_registers.h b/drivers/staging/rdma/hfi1/chip_registers.h
> index bf45de29d8bd..d0deb2278635 100644
> --- a/drivers/staging/rdma/hfi1/chip_registers.h
> +++ b/drivers/staging/rdma/hfi1/chip_registers.h
> @@ -549,6 +549,17 @@
>  #define CCE_MSIX_TABLE_UPPER (CCE + 0x000000100008)
>  #define CCE_MSIX_TABLE_UPPER_RESETCSR 0x0000000100000000ull
>  #define CCE_MSIX_VEC_CLR_WITHOUT_INT (CCE + 0x000000110400)
> +#define CCE_PCIE_CTRL (CCE + 0x0000000000C0)
> +#define CCE_PCIE_CTRL_PCIE_LANE_BUNDLE_MASK 0x3ull
> +#define CCE_PCIE_CTRL_PCIE_LANE_BUNDLE_SHIFT 0
> +#define CCE_PCIE_CTRL_PCIE_LANE_DELAY_MASK 0xFull
> +#define CCE_PCIE_CTRL_PCIE_LANE_DELAY_SHIFT 2
> +#define CCE_PCIE_CTRL_XMT_MARGIN_OVERWRITE_ENABLE_SHIFT 8
> +#define CCE_PCIE_CTRL_XMT_MARGIN_SHIFT 9
> +#define CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_OVERWRITE_ENABLE_MASK 0x1ull
> +#define CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_OVERWRITE_ENABLE_SHIFT 12
> +#define CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_MASK 0x7ull
> +#define CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_SHIFT 13
>  #define CCE_REVISION (CCE + 0x000000000000)
>  #define CCE_REVISION2 (CCE + 0x000000000008)
>  #define CCE_REVISION2_HFI_ID_MASK 0x1ull
> diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c
> index 0b7eafb0fc70..eb3e2159ad41 100644
> --- a/drivers/staging/rdma/hfi1/pcie.c
> +++ b/drivers/staging/rdma/hfi1/pcie.c
> @@ -867,6 +867,83 @@ static void arm_gasket_logic(struct hfi1_devdata *dd)
>  }
>  
>  /*
> + * CCE_PCIE_CTRL long name helpers
> + * We redefine these shorter macros to use in the code while leaving
> + * chip_registers.h to be autogenerated from the hardware spec.
> + */
> +#define LANE_BUNDLE_MASK              CCE_PCIE_CTRL_PCIE_LANE_BUNDLE_MASK
> +#define LANE_BUNDLE_SHIFT             CCE_PCIE_CTRL_PCIE_LANE_BUNDLE_SHIFT
> +#define LANE_DELAY_MASK               CCE_PCIE_CTRL_PCIE_LANE_DELAY_MASK
> +#define LANE_DELAY_SHIFT              CCE_PCIE_CTRL_PCIE_LANE_DELAY_SHIFT
> +#define MARGIN_OVERWRITE_ENABLE_SHIFT CCE_PCIE_CTRL_XMT_MARGIN_OVERWRITE_ENABLE_SHIFT
> +#define MARGIN_SHIFT                  CCE_PCIE_CTRL_XMT_MARGIN_SHIFT
> +#define MARGIN_G1_G2_OVERWRITE_MASK   CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_OVERWRITE_ENABLE_MASK
> +#define MARGIN_G1_G2_OVERWRITE_SHIFT  CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_OVERWRITE_ENABLE_SHIFT
> +#define MARGIN_GEN1_GEN2_MASK         CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_MASK
> +#define MARGIN_GEN1_GEN2_SHIFT        CCE_PCIE_CTRL_XMT_MARGIN_GEN1_GEN2_SHIFT
> +
> + /*
> +  * Write xmt_margin for full-swing (WFR-B) or half-swing (WFR-C).
> +  */
> +static void write_xmt_margin(struct hfi1_devdata *dd, const char *fname)
> +{
> +	u64 pcie_ctrl;
> +	u64 xmt_margin;
> +	u64 xmt_margin_oe;
> +	u64 lane_delay;
> +	u64 lane_bundle;
> +
> +	pcie_ctrl = read_csr(dd, CCE_PCIE_CTRL);
> +
> +	/*
> +	 * For Discrete, use full-swing.
> +	 *  - PCIe TX defaults to full-swing.
> +	 *    Leave this register as default.
> +	 * For Integrated, use half-swing
> +	 *  - Copy xmt_margin and xmt_margin_oe
> +	 *    from Gen1/Gen2 to Gen3.
> +	 */
> +	if (dd->pcidev->device == PCI_DEVICE_ID_INTEL1) { /* integrated */
> +		/* extract initial fields */
> +		xmt_margin = (pcie_ctrl >> MARGIN_GEN1_GEN2_SHIFT)
> +			      & MARGIN_GEN1_GEN2_MASK;
> +		xmt_margin_oe = (pcie_ctrl >> MARGIN_G1_G2_OVERWRITE_SHIFT)
> +				 & MARGIN_G1_G2_OVERWRITE_MASK;
> +		lane_delay = (pcie_ctrl >> LANE_DELAY_SHIFT) & LANE_DELAY_MASK;
> +		lane_bundle = (pcie_ctrl >> LANE_BUNDLE_SHIFT)
> +			       & LANE_BUNDLE_MASK;
> +
> +		/*
> +		 * For A0, EFUSE values are not set.  Override with the
> +		 * correct values.
> +		 */
> +		if (is_a0(dd)) {

This line causes a build error, please be more careful and test your
patches before you send them out :(

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-12-21 21:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 19:47 [PATCH v4 0/2] staging/rdma/hfi1: set Gen 3 half-swing for integrated devices ira.weiny
2015-12-01 19:47 ` [PATCH v4 1/2] staging/rdma/hf1: add dd_dev_dbg ira.weiny
     [not found] ` <1448999277-22972-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-01 19:47   ` [PATCH v4 2/2] staging/rdma/hfi1: set Gen3 half-swing for integrated devices ira.weiny-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1448999277-22972-3-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-21 21:48       ` Greg KH [this message]
2015-12-14 19:54   ` [PATCH v4 0/2] staging/rdma/hfi1: set Gen 3 " ira.weiny
2015-12-14 21:48     ` Greg KH

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=20151221214822.GA13485@kroah.com \
    --to=gregkh-hqyy1w1ycw8ekmwlsbkhg0b+6bgklq7r@public.gmane.org \
    --cc=dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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.