| @@ -9,6 +9,7 @@ · 8 unmodified lines |
| 9 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | 9 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> |
| 10 | *******************************************************************************/ | 10 | *******************************************************************************/ |
| 11 | | 11 | |
| | 12 | #include <linux/clk-provider.h> |
| 12 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
| 13 | #include <linux/dmi.h> | 14 | #include <linux/dmi.h> |
| 14 | | 15 | |
| @@ -174,6 +175,19 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, · 159 unmodified lines |
| 174 | plat->axi->axi_blen[1] = 8; | 175 | plat->axi->axi_blen[1] = 8; |
| 175 | plat->axi->axi_blen[2] = 16; | 176 | plat->axi->axi_blen[2] = 16; |
| 176 | | 177 | |
| | 178 | plat->ptp_max_adj = plat->clk_ptp_rate; |
| | 179 | |
| | 180 | /* Set system clock */ |
| | 181 | plat->stmmac_clk = clk_register_fixed_rate(&pdev->dev, |
| | 182 | "stmmac-clk", NULL, 0, |
| | 183 | plat->clk_ptp_rate); |
| | 184 | |
| | 185 | if (IS_ERR(plat->stmmac_clk)) { |
| | 186 | dev_warn(&pdev->dev, "Fail to register stmmac-clk\n"); |
| | 187 | plat->stmmac_clk = NULL; |
| | 188 | } |
| | 189 | clk_prepare_enable(plat->stmmac_clk); |
| | 190 | |
| 177 | /* Set default value for multicast hash bins */ | 191 | /* Set default value for multicast hash bins */ |
| 178 | plat->multicast_filter_bins = HASH_TABLE_SIZE; | 192 | plat->multicast_filter_bins = HASH_TABLE_SIZE; |
| 179 | | 193 | |
| @@ -193,6 +207,7 @@ static int ehl_common_data(struct pci_dev *pdev, · 13 unmodified lines |
| 193 | | 207 | |
| 194 | plat->rx_queues_to_use = 8; | 208 | plat->rx_queues_to_use = 8; |
| 195 | plat->tx_queues_to_use = 8; | 209 | plat->tx_queues_to_use = 8; |
| | 210 | plat->clk_ptp_rate = 200000000; |
| 196 | ret = intel_mgbe_common_data(pdev, plat); | 211 | ret = intel_mgbe_common_data(pdev, plat); |
| 197 | if (ret) | 212 | if (ret) |
| 198 | return ret; | 213 | return ret; |
| @@ -233,6 +248,7 @@ static int tgl_common_data(struct pci_dev *pdev, · 34 unmodified lines |
| 233 | | 248 | |
| 234 | plat->rx_queues_to_use = 6; | 249 | plat->rx_queues_to_use = 6; |
| 235 | plat->tx_queues_to_use = 4; | 250 | plat->tx_queues_to_use = 4; |
| | 251 | plat->clk_ptp_rate = 200000000; |
| 236 | ret = intel_mgbe_common_data(pdev, plat); | 252 | ret = intel_mgbe_common_data(pdev, plat); |
| 237 | if (ret) | 253 | if (ret) |
| 238 | return ret; | 254 | return ret; |
| @@ -438,10 +454,15 @@ static int stmmac_pci_probe(struct pci_dev *pdev, · 199 unmodified lines |
| 438 | */ | 454 | */ |
| 439 | static void stmmac_pci_remove(struct pci_dev *pdev) | 455 | static void stmmac_pci_remove(struct pci_dev *pdev) |
| 440 | { | 456 | { |
| | 457 | struct net_device *ndev = dev_get_drvdata(&pdev->dev); |
| | 458 | struct stmmac_priv *priv = netdev_priv(ndev); |
| 441 | int i; | 459 | int i; |
| 442 | | 460 | |
| 443 | stmmac_dvr_remove(&pdev->dev); | 461 | stmmac_dvr_remove(&pdev->dev); |
| 444 | | 462 | |
| | 463 | if (priv->plat->stmmac_clk) |
| | 464 | clk_unregister_fixed_rate(priv->plat->stmmac_clk); |
| | 465 | |
| 445 | for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { | 466 | for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { |
| 446 | if (pci_resource_len(pdev, i) == 0) | 467 | if (pci_resource_len(pdev, i) == 0) |
| 447 | continue; | 468 | continue; |