Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: qcom-qmp-pcie: add register init helper

Generalise the serdes initialisation helper so that it can be used to
initialise all the PHY registers (e.g. serdes, tx, rx, pcs).

Note that this defers the ungating of the PIPE clock somewhat, which is
fine as it isn't needed until starting the PHY.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20221105145939.20318-10-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Johan Hovold and committed by
Vinod Koul
ec7bc1b4 d8c9a1e9

+10 -31
+10 -31
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
··· 1820 1820 qmp_pcie_configure_lane(base, tbl, num, 0xff); 1821 1821 } 1822 1822 1823 - static void qmp_pcie_serdes_init(struct qmp_pcie *qmp, const struct qmp_phy_cfg_tbls *tbls) 1823 + static void qmp_pcie_init_registers(struct qmp_pcie *qmp, const struct qmp_phy_cfg_tbls *tbls) 1824 1824 { 1825 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1825 1826 void __iomem *serdes = qmp->serdes; 1827 + void __iomem *tx = qmp->tx; 1828 + void __iomem *rx = qmp->rx; 1829 + void __iomem *tx2 = qmp->tx2; 1830 + void __iomem *rx2 = qmp->rx2; 1831 + void __iomem *pcs = qmp->pcs; 1832 + void __iomem *pcs_misc = qmp->pcs_misc; 1826 1833 1827 1834 if (!tbls) 1828 1835 return; 1829 1836 1830 1837 qmp_pcie_configure(serdes, tbls->serdes, tbls->serdes_num); 1831 - } 1832 - 1833 - static void qmp_pcie_lanes_init(struct qmp_pcie *qmp, const struct qmp_phy_cfg_tbls *tbls) 1834 - { 1835 - const struct qmp_phy_cfg *cfg = qmp->cfg; 1836 - void __iomem *tx = qmp->tx; 1837 - void __iomem *rx = qmp->rx; 1838 - void __iomem *tx2 = qmp->tx2; 1839 - void __iomem *rx2 = qmp->rx2; 1840 - 1841 - if (!tbls) 1842 - return; 1843 1838 1844 1839 qmp_pcie_configure_lane(tx, tbls->tx, tbls->tx_num, 1); 1845 1840 qmp_pcie_configure_lane(rx, tbls->rx, tbls->rx_num, 1); ··· 1843 1848 qmp_pcie_configure_lane(tx2, tbls->tx, tbls->tx_num, 2); 1844 1849 qmp_pcie_configure_lane(rx2, tbls->rx, tbls->rx_num, 2); 1845 1850 } 1846 - } 1847 - 1848 - static void qmp_pcie_pcs_init(struct qmp_pcie *qmp, const struct qmp_phy_cfg_tbls *tbls) 1849 - { 1850 - void __iomem *pcs = qmp->pcs; 1851 - void __iomem *pcs_misc = qmp->pcs_misc; 1852 - 1853 - if (!tbls) 1854 - return; 1855 1851 1856 1852 qmp_pcie_configure(pcs, tbls->pcs, tbls->pcs_num); 1857 1853 qmp_pcie_configure(pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num); ··· 1918 1932 else 1919 1933 mode_tbls = cfg->tbls_ep; 1920 1934 1921 - qmp_pcie_serdes_init(qmp, &cfg->tbls); 1922 - qmp_pcie_serdes_init(qmp, mode_tbls); 1935 + qmp_pcie_init_registers(qmp, &cfg->tbls); 1936 + qmp_pcie_init_registers(qmp, mode_tbls); 1923 1937 1924 1938 ret = clk_prepare_enable(qmp->pipe_clk); 1925 1939 if (ret) { 1926 1940 dev_err(qmp->dev, "pipe_clk enable failed err=%d\n", ret); 1927 1941 return ret; 1928 1942 } 1929 - 1930 - /* Tx, Rx, and PCS configurations */ 1931 - qmp_pcie_lanes_init(qmp, &cfg->tbls); 1932 - qmp_pcie_lanes_init(qmp, mode_tbls); 1933 - 1934 - qmp_pcie_pcs_init(qmp, &cfg->tbls); 1935 - qmp_pcie_pcs_init(qmp, mode_tbls); 1936 1943 1937 1944 /* Pull PHY out of reset state */ 1938 1945 qphy_clrbits(pcs, cfg->regs[QPHY_SW_RESET], SW_RESET);