aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phy/phy-miphy28lp.c
diff options
context:
space:
mode:
authorGabriel FERNANDEZ <gabriel.fernandez@st.com>2014-11-04 05:51:22 -0500
committerKishon Vijay Abraham I <kishon@ti.com>2014-11-12 08:10:12 -0500
commita2108dee3cd39f7291d013c50c33c2a639a17b42 (patch)
tree080ab7567af3d2eb6e123dcc7fabce61fd124d41 /drivers/phy/phy-miphy28lp.c
parent2b041b27a83fbe951d4b1cb1523001d4a8a5cccb (diff)
phy: miphy28lp: Add SSC support for PCIE
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.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy/phy-miphy28lp.c')
-rw-r--r--drivers/phy/phy-miphy28lp.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c
index d2f797c79fbc..d8ff8956ed05 100644
--- a/drivers/phy/phy-miphy28lp.c
+++ b/drivers/phy/phy-miphy28lp.c
@@ -192,6 +192,7 @@
192#define SATA_SPDMODE 1 192#define SATA_SPDMODE 1
193 193
194#define MIPHY_SATA_BANK_NB 3 194#define MIPHY_SATA_BANK_NB 3
195#define MIPHY_PCIE_BANK_NB 2
195 196
196struct miphy28lp_phy { 197struct miphy28lp_phy {
197 struct phy *phy; 198 struct phy *phy;
@@ -591,6 +592,46 @@ static void miphy_sata_tune_ssc(struct miphy28lp_phy *miphy_phy)
591 } 592 }
592} 593}
593 594
595static void miphy_pcie_tune_ssc(struct miphy28lp_phy *miphy_phy)
596{
597 void __iomem *base = miphy_phy->base;
598 u8 val;
599
600 /* Compensate Tx impedance to avoid out of range values */
601 /*
602 * Enable the SSC on PLL for all banks
603 * SSC Modulation @ 31 KHz and 4000 ppm modulation amp
604 */
605 val = readb_relaxed(base + MIPHY_BOUNDARY_2);
606 val |= SSC_EN_SW;
607 writeb_relaxed(val, base + MIPHY_BOUNDARY_2);
608
609 val = readb_relaxed(base + MIPHY_BOUNDARY_SEL);
610 val |= SSC_SEL;
611 writeb_relaxed(val, base + MIPHY_BOUNDARY_SEL);
612
613 for (val = 0; val < MIPHY_PCIE_BANK_NB; val++) {
614 writeb_relaxed(val, base + MIPHY_CONF);
615
616 /* Validate Step component */
617 writeb_relaxed(0x69, base + MIPHY_PLL_SBR_3);
618 writeb_relaxed(0x21, base + MIPHY_PLL_SBR_4);
619
620 /* Validate Period component */
621 writeb_relaxed(0x3c, base + MIPHY_PLL_SBR_2);
622 writeb_relaxed(0x21, base + MIPHY_PLL_SBR_4);
623
624 /* Clear any previous request */
625 writeb_relaxed(0x00, base + MIPHY_PLL_SBR_1);
626
627 /* requests the PLL to take in account new parameters */
628 writeb_relaxed(SET_NEW_CHANGE, base + MIPHY_PLL_SBR_1);
629
630 /* To be sure there is no other pending requests */
631 writeb_relaxed(0x00, base + MIPHY_PLL_SBR_1);
632 }
633}
634
594static inline int miphy28lp_configure_sata(struct miphy28lp_phy *miphy_phy) 635static inline int miphy28lp_configure_sata(struct miphy28lp_phy *miphy_phy)
595{ 636{
596 void __iomem *base = miphy_phy->base; 637 void __iomem *base = miphy_phy->base;
@@ -659,6 +700,9 @@ static inline int miphy28lp_configure_pcie(struct miphy28lp_phy *miphy_phy)
659 if (err) 700 if (err)
660 return err; 701 return err;
661 702
703 if (miphy_phy->ssc)
704 miphy_pcie_tune_ssc(miphy_phy);
705
662 return 0; 706 return 0;
663} 707}
664 708