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>,
Giuseppe Condorelli <giuseppe.condorelli@st.com>
Subject: [PATCH v2 6/8] phy: miphy28lp: Add SSC support for SATA
Date: Wed, 3 Sep 2014 17:37:15 +0200 [thread overview]
Message-ID: <1409758637-28654-7-git-send-email-gabriel.fernandez@linaro.org> (raw)
In-Reply-To: <1409758637-28654-1-git-send-email-gabriel.fernandez@linaro.org>
This patch to tune on/off the ssc on miphy sata setup.
User can now enable ssc via dt blob, it is useful to reduce
effects of EMI.
Signed-off-by: Giuseppe Condorelli <giuseppe.condorelli@st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@linaro.org>
---
.../devicetree/bindings/phy/phy-miphy28lp.txt | 1 +
drivers/phy/phy-miphy28lp.c | 35 ++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/phy-miphy28lp.txt b/Documentation/devicetree/bindings/phy/phy-miphy28lp.txt
index 5e307af..49bb7bb 100644
--- a/Documentation/devicetree/bindings/phy/phy-miphy28lp.txt
+++ b/Documentation/devicetree/bindings/phy/phy-miphy28lp.txt
@@ -39,6 +39,7 @@ Optional properties (port (child) node):
register.
- st,px_rx_pol_inv : to invert polarity of RXn/RXp (respectively negative line and positive
line).
+- st,scc-on : enable ssc to reduce effects of EMI (only for sata or PCIe).
example:
diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c
index aa36cea..b36e737 100644
--- a/drivers/phy/phy-miphy28lp.c
+++ b/drivers/phy/phy-miphy28lp.c
@@ -140,6 +140,7 @@ struct miphy28lp_phy {
bool osc_force_ext;
bool osc_rdy;
bool px_rx_pol_inv;
+ bool ssc;
struct reset_control *miphy_rst;
@@ -604,6 +605,36 @@ static int miphy28lp_setup(struct miphy28lp_phy *miphy_phy, u32 miphy_val)
return miphy_osc_is_ready(miphy_phy);
}
+static void miphy_sata_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 < 3; val++) {
+ writeb_relaxed(val, miphy_phy->base + 0x0f);
+ writeb_relaxed(0x3c, miphy_phy->base + 0xe4);
+ writeb_relaxed(0x6c, miphy_phy->base + 0xe5);
+ writeb_relaxed(0x81, 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_sata(struct miphy28lp_phy *miphy_phy)
{
struct miphy28lp_dev *miphy_dev = miphy_phy->phydev;
@@ -643,6 +674,8 @@ static int miphy28lp_init_sata(struct miphy28lp_phy *miphy_phy)
writeb_relaxed(val, miphy_phy->base + MIPHY_CONTROL);
}
+ miphy_sata_tune_ssc(miphy_phy);
+
return miphy_is_ready(miphy_phy);
}
@@ -872,6 +905,8 @@ static int miphy28lp_of_probe(struct device_node *np,
miphy_phy->px_rx_pol_inv =
of_property_read_bool(np, "st,px_rx_pol_inv");
+ miphy_phy->ssc = of_property_read_bool(np, "st,ssc-on");
+
of_property_read_u32(np, "st,sata-gen", &miphy_phy->sata_gen);
if (!miphy_phy->sata_gen)
miphy_phy->sata_gen = SATA_GEN1;
--
1.9.1
next prev 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 ` Gabriel FERNANDEZ [this message]
2014-09-03 15:37 ` [PATCH v2 7/8] phy: miphy28lp: Add SSC support for PCIE Gabriel FERNANDEZ
[not found] ` <1409758637-28654-8-git-send-email-gabriel.fernandez-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-09-08 15:15 ` 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-7-git-send-email-gabriel.fernandez@linaro.org \
--to=gabriel.fernandez@st.com \
--cc=devicetree@vger.kernel.org \
--cc=gabriel.fernandez@linaro.org \
--cc=galak@codeaurora.org \
--cc=giuseppe.condorelli@st.com \
--cc=grant.likely@linaro.org \
--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).