Loading drivers/net/ethernet/stmicro/stmmac/Makefile +2 −0 Original line number Diff line number Diff line Loading @@ -27,5 +27,7 @@ obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o stmmac-platform-objs:= stmmac_platform.o dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o ccflags-$(CONFIG_PTP_1588_CLOCK)+=-DCONFIG_PTPSUPPORT_OBJ obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o stmmac-pci-objs:= stmmac_pci.o drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-pps.c +39 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ int ppsout_stop(struct stmmac_priv *priv, struct pps_cfg *eth_pps_cfg) u32 val; void __iomem *ioaddr = priv->ioaddr; val = readl_relaxed(ioaddr + MAC_PPS_CONTROL); val |= PPSCMDX(eth_pps_cfg->ppsout_ch, 0x5); val |= TRGTMODSELX(eth_pps_cfg->ppsout_ch, 0x3); val |= PPSEN0; Loading Loading @@ -186,6 +187,17 @@ static void ethqos_register_pps_isr(struct stmmac_priv *priv, int ch) } } static void ethqos_unregister_pps_isr(struct stmmac_priv *priv, int ch) { struct qcom_ethqos *ethqos = priv->plat->bsp_priv; if (ch == DWC_ETH_QOS_PPS_CH_2) { free_irq(ethqos->pps_class_a_irq, priv); } else if (ch == DWC_ETH_QOS_PPS_CH_3) { free_irq(ethqos->pps_class_b_irq, priv); } } int ppsout_config(struct stmmac_priv *priv, struct ifr_data_struct *req) { struct pps_cfg *eth_pps_cfg = (struct pps_cfg *)req->ptr; Loading @@ -196,6 +208,9 @@ int ppsout_config(struct stmmac_priv *priv, struct ifr_data_struct *req) if (!eth_pps_cfg->ppsout_start) { ppsout_stop(priv, eth_pps_cfg); if (eth_pps_cfg->ppsout_ch == DWC_ETH_QOS_PPS_CH_2 || eth_pps_cfg->ppsout_ch == DWC_ETH_QOS_PPS_CH_3) ethqos_unregister_pps_isr(priv, eth_pps_cfg->ppsout_ch); return 0; } Loading Loading @@ -247,6 +262,30 @@ int ppsout_config(struct stmmac_priv *priv, struct ifr_data_struct *req) return 0; } int ethqos_init_pps(struct stmmac_priv *priv) { u32 value; struct ifr_data_struct req = {0}; struct pps_cfg eth_pps_cfg = {0}; priv->ptpaddr = priv->ioaddr + PTP_GMAC4_OFFSET; value = (PTP_TCR_TSENA | PTP_TCR_TSCFUPDT | PTP_TCR_TSUPDT); priv->hw->ptp->config_hw_tstamping(priv->ptpaddr, value); priv->hw->ptp->init_systime(priv->ptpaddr, 0, 0); priv->hw->ptp->adjust_systime(priv->ptpaddr, 0, 0, 0, 1); /*Configuaring PPS0 PPS output frequency to default 19.2 Mhz*/ eth_pps_cfg.ppsout_ch = 0; eth_pps_cfg.ptpclk_freq = 62500000; eth_pps_cfg.ppsout_freq = 19200000; eth_pps_cfg.ppsout_start = 1; eth_pps_cfg.ppsout_duty = 50; req.ptr = (void *)ð_pps_cfg; ppsout_config(priv, &req); return 0; } int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct stmmac_priv *pdata = netdev_priv(dev); Loading drivers/net/ethernet/stmicro/stmmac/stmmac.h +1 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ extern struct emac_emb_smmu_cb_ctx emac_emb_smmu_ctx; &emac_emb_smmu_ctx.smmu_pdev->dev : priv->device) int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int ethqos_init_pps(struct stmmac_priv *priv); extern bool phy_intr_en; int stmmac_mdio_unregister(struct net_device *ndev); Loading drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 −0 Original line number Diff line number Diff line Loading @@ -2529,6 +2529,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) netdev_warn(priv->dev, "PTP init failed\n"); else ret = clk_set_rate(priv->plat->clk_ptp_ref, 96000000); ret = ethqos_init_pps(priv); } priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS; Loading Loading @@ -2611,7 +2612,12 @@ static int stmmac_open(struct net_device *dev) goto init_error; } #ifdef CONFIG_PTPSUPPORT_OBJ ret = stmmac_hw_setup(dev, true); #else ret = stmmac_hw_setup(dev, false); #endif if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); goto init_error; Loading Loading
drivers/net/ethernet/stmicro/stmmac/Makefile +2 −0 Original line number Diff line number Diff line Loading @@ -27,5 +27,7 @@ obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o stmmac-platform-objs:= stmmac_platform.o dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o ccflags-$(CONFIG_PTP_1588_CLOCK)+=-DCONFIG_PTPSUPPORT_OBJ obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o stmmac-pci-objs:= stmmac_pci.o
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-pps.c +39 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ int ppsout_stop(struct stmmac_priv *priv, struct pps_cfg *eth_pps_cfg) u32 val; void __iomem *ioaddr = priv->ioaddr; val = readl_relaxed(ioaddr + MAC_PPS_CONTROL); val |= PPSCMDX(eth_pps_cfg->ppsout_ch, 0x5); val |= TRGTMODSELX(eth_pps_cfg->ppsout_ch, 0x3); val |= PPSEN0; Loading Loading @@ -186,6 +187,17 @@ static void ethqos_register_pps_isr(struct stmmac_priv *priv, int ch) } } static void ethqos_unregister_pps_isr(struct stmmac_priv *priv, int ch) { struct qcom_ethqos *ethqos = priv->plat->bsp_priv; if (ch == DWC_ETH_QOS_PPS_CH_2) { free_irq(ethqos->pps_class_a_irq, priv); } else if (ch == DWC_ETH_QOS_PPS_CH_3) { free_irq(ethqos->pps_class_b_irq, priv); } } int ppsout_config(struct stmmac_priv *priv, struct ifr_data_struct *req) { struct pps_cfg *eth_pps_cfg = (struct pps_cfg *)req->ptr; Loading @@ -196,6 +208,9 @@ int ppsout_config(struct stmmac_priv *priv, struct ifr_data_struct *req) if (!eth_pps_cfg->ppsout_start) { ppsout_stop(priv, eth_pps_cfg); if (eth_pps_cfg->ppsout_ch == DWC_ETH_QOS_PPS_CH_2 || eth_pps_cfg->ppsout_ch == DWC_ETH_QOS_PPS_CH_3) ethqos_unregister_pps_isr(priv, eth_pps_cfg->ppsout_ch); return 0; } Loading Loading @@ -247,6 +262,30 @@ int ppsout_config(struct stmmac_priv *priv, struct ifr_data_struct *req) return 0; } int ethqos_init_pps(struct stmmac_priv *priv) { u32 value; struct ifr_data_struct req = {0}; struct pps_cfg eth_pps_cfg = {0}; priv->ptpaddr = priv->ioaddr + PTP_GMAC4_OFFSET; value = (PTP_TCR_TSENA | PTP_TCR_TSCFUPDT | PTP_TCR_TSUPDT); priv->hw->ptp->config_hw_tstamping(priv->ptpaddr, value); priv->hw->ptp->init_systime(priv->ptpaddr, 0, 0); priv->hw->ptp->adjust_systime(priv->ptpaddr, 0, 0, 0, 1); /*Configuaring PPS0 PPS output frequency to default 19.2 Mhz*/ eth_pps_cfg.ppsout_ch = 0; eth_pps_cfg.ptpclk_freq = 62500000; eth_pps_cfg.ppsout_freq = 19200000; eth_pps_cfg.ppsout_start = 1; eth_pps_cfg.ppsout_duty = 50; req.ptr = (void *)ð_pps_cfg; ppsout_config(priv, &req); return 0; } int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct stmmac_priv *pdata = netdev_priv(dev); Loading
drivers/net/ethernet/stmicro/stmmac/stmmac.h +1 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ extern struct emac_emb_smmu_cb_ctx emac_emb_smmu_ctx; &emac_emb_smmu_ctx.smmu_pdev->dev : priv->device) int ethqos_handle_prv_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int ethqos_init_pps(struct stmmac_priv *priv); extern bool phy_intr_en; int stmmac_mdio_unregister(struct net_device *ndev); Loading
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 −0 Original line number Diff line number Diff line Loading @@ -2529,6 +2529,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) netdev_warn(priv->dev, "PTP init failed\n"); else ret = clk_set_rate(priv->plat->clk_ptp_ref, 96000000); ret = ethqos_init_pps(priv); } priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS; Loading Loading @@ -2611,7 +2612,12 @@ static int stmmac_open(struct net_device *dev) goto init_error; } #ifdef CONFIG_PTPSUPPORT_OBJ ret = stmmac_hw_setup(dev, true); #else ret = stmmac_hw_setup(dev, false); #endif if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); goto init_error; Loading