devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gabriel FERNANDEZ <gabriel.fernandez@st.com>
To: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Srinivas Kandagatla <srinivas.kandagatla@gmail.com>,
	Maxime Coquelin <maxime.coquelin@st.com>,
	Patrice Chotard <patrice.chotard@st.com>,
	Russell King <linux@arm.linux.org.uk>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Grant Likely <grant.likely@linaro.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, kernel@stlinux.com,
	Gabriel Fernandez <gabriel.fernandez@linaro.org>,
	Harsh Gupta <harsh.gupta@st.com>,
	Gabriel Fernandez <gabriel.fernandez@linaro.orgm>
Subject: [PATCH v2 7/8] phy: miphy28lp: Add SSC support for PCIE
Date: Wed,  3 Sep 2014 17:37:16 +0200	[thread overview]
Message-ID: <1409758637-28654-8-git-send-email-gabriel.fernandez@linaro.org> (raw)
In-Reply-To: <1409758637-28654-1-git-send-email-gabriel.fernandez@linaro.org>

SSC is the technique of modulating the operating frequency of a signal
slightly to spread its radiated emissions over a range of frequencies.
This reduction in the maximum emission for a given frequency helps meet
radiated emission requirements.
These settings are applicable for PCIE with Internal clock.

Signed-off-by: Harsh Gupta <harsh.gupta@st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@linaro.orgm>
---
 drivers/phy/phy-miphy28lp.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c
index b36e737..976fdda 100644
--- a/drivers/phy/phy-miphy28lp.c
+++ b/drivers/phy/phy-miphy28lp.c
@@ -679,6 +679,36 @@ static int miphy28lp_init_sata(struct miphy28lp_phy *miphy_phy)
 	return miphy_is_ready(miphy_phy);
 }
 
+static void miphy_pcie_tune_ssc(struct miphy28lp_phy *miphy_phy)
+{
+	u8 val;
+
+	/* Compensate Tx impedance to avoid out of range values */
+	if (miphy_phy->ssc) {
+		/*
+		 * Enable the SSC on PLL for all banks
+		 * SSC Modulation @ 31 KHz and 4000 ppm modulation amp
+		 */
+		val = readb_relaxed(miphy_phy->base + 0x0c);
+		val |= 0x04;
+		writeb_relaxed(val, miphy_phy->base + 0x0c);
+		val = readb_relaxed(miphy_phy->base + 0x0a);
+		val |= 0x10;
+		writeb_relaxed(val, miphy_phy->base + 0x0a);
+
+		for (val = 0; val < 2; val++) {
+			writeb_relaxed(val, miphy_phy->base + 0x0f);
+			writeb_relaxed(0x69, miphy_phy->base + 0xe5);
+			writeb_relaxed(0x21, miphy_phy->base + 0xe6);
+			writeb_relaxed(0x3c, miphy_phy->base + 0xe4);
+			writeb_relaxed(0x21, miphy_phy->base + 0xe6);
+			writeb_relaxed(0x00, miphy_phy->base + 0xe3);
+			writeb_relaxed(0x02, miphy_phy->base + 0xe3);
+			writeb_relaxed(0x00, miphy_phy->base + 0xe3);
+		}
+	}
+}
+
 static int miphy28lp_init_pcie(struct miphy28lp_phy *miphy_phy)
 {
 	struct miphy28lp_dev *miphy_dev = miphy_phy->phydev;
@@ -710,6 +740,8 @@ static int miphy28lp_init_pcie(struct miphy28lp_phy *miphy_phy)
 	/* initialize miphy */
 	miphy28lp_configure_pcie(miphy_phy);
 
+	miphy_pcie_tune_ssc(miphy_phy);
+
 	/* Waiting for Compensation to complete */
 	do {
 		val = readb_relaxed(miphy_phy->base + MIPHY_COMP_FSM_6);
-- 
1.9.1

  parent reply	other threads:[~2014-09-03 15:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 15:37 [PATCH v2 0/8] phy: miphy28lp: Introduce support for MiPHY28lp Gabriel FERNANDEZ
2014-09-03 15:37 ` [PATCH v2 1/8] phy: miphy28lp: Add Device Tree bindings for the MiPHY28lp Gabriel FERNANDEZ
     [not found]   ` <1409758637-28654-2-git-send-email-gabriel.fernandez-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-09-08 14:33     ` Kishon Vijay Abraham I
     [not found]       ` <540DBE43.50403-l0cyMroinI0@public.gmane.org>
2014-09-09  9:24         ` Gabriel Fernandez
2014-09-03 15:37 ` [PATCH v2 2/8] phy: miphy28lp: Add MiPHY28lp header file for DT x Driver defines Gabriel FERNANDEZ
2014-09-03 15:37 ` [PATCH v2 3/8] phy: miphy28lp: Provide support for the MiPHY28lp Generic PHY Gabriel FERNANDEZ
2014-09-08 15:12   ` Kishon Vijay Abraham I
     [not found]     ` <540DC75C.40509-l0cyMroinI0@public.gmane.org>
2014-09-09  9:15       ` Gabriel Fernandez
     [not found] ` <1409758637-28654-1-git-send-email-gabriel.fernandez-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-09-03 15:37   ` [PATCH v2 4/8] ARM: DT: STi: STiH407: Add DT node for MiPHY28lp Gabriel FERNANDEZ
2014-09-03 15:37 ` [PATCH v2 5/8] ARM: multi_v7_defconfig: Enable MiPHY28lp - ST's Generic (SATA, PCIe & USB3) PHY Gabriel FERNANDEZ
2014-09-03 15:37 ` [PATCH v2 6/8] phy: miphy28lp: Add SSC support for SATA Gabriel FERNANDEZ
2014-09-03 15:37 ` Gabriel FERNANDEZ [this message]
     [not found]   ` <1409758637-28654-8-git-send-email-gabriel.fernandez-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-09-08 15:15     ` [PATCH v2 7/8] phy: miphy28lp: Add SSC support for PCIE Kishon Vijay Abraham I
     [not found]       ` <540DC81F.6000901-l0cyMroinI0@public.gmane.org>
2014-09-09  9:23         ` Gabriel Fernandez
2014-09-03 15:37 ` [PATCH v2 8/8] phy: miphy28lp: Tune tx impedance across Soc cuts Gabriel FERNANDEZ

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=1409758637-28654-8-git-send-email-gabriel.fernandez@linaro.org \
    --to=gabriel.fernandez@st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gabriel.fernandez@linaro.org \
    --cc=gabriel.fernandez@linaro.orgm \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=harsh.gupta@st.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=kernel@stlinux.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=maxime.coquelin@st.com \
    --cc=patrice.chotard@st.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).