aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKweh, Hock Leong <hock.leong.kweh@intel.com>2015-01-27 14:44:47 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-28 00:08:08 -0500
commit5b99a6b6cc563e29265502b2b3df39c872022c22 (patch)
tree8810d97f7c98c9ed6e43b2bcd5ca988c21af97fe
parent488327c6ef2a2f39adc6d9f017745921c8b747e5 (diff)
stmmac: pci: add support for Intel Quark X1000
The Intel Quark SoC X1000 provides two 10/100 Mbps Ethernet MAC controllers which may or may not be connected to PHY on board. This MAC controller only supports RMII PHY. This patch add Quark PCI ID as well as Quark default platform data info to this driver. Signed-off-by: Kweh, Hock Leong <hock.leong.kweh@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 054520d67de4..a316187967ea 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -26,6 +26,12 @@
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include "stmmac.h" 27#include "stmmac.h"
28 28
29struct stmmac_pci_info {
30 struct pci_dev *pdev;
31 int (*setup)(struct plat_stmmacenet_data *plat,
32 struct stmmac_pci_info *info);
33};
34
29static void stmmac_default_data(struct plat_stmmacenet_data *plat) 35static void stmmac_default_data(struct plat_stmmacenet_data *plat)
30{ 36{
31 plat->bus_id = 1; 37 plat->bus_id = 1;
@@ -48,6 +54,38 @@ static void stmmac_default_data(struct plat_stmmacenet_data *plat)
48 plat->unicast_filter_entries = 1; 54 plat->unicast_filter_entries = 1;
49} 55}
50 56
57static int quark_default_data(struct plat_stmmacenet_data *plat,
58 struct stmmac_pci_info *info)
59{
60 struct pci_dev *pdev = info->pdev;
61
62 plat->bus_id = PCI_DEVID(pdev->bus->number, pdev->devfn);
63 plat->phy_addr = 1;
64 plat->interface = PHY_INTERFACE_MODE_RMII;
65 plat->clk_csr = 2;
66 plat->has_gmac = 1;
67 plat->force_sf_dma_mode = 1;
68
69 plat->mdio_bus_data->phy_reset = NULL;
70 plat->mdio_bus_data->phy_mask = 0;
71
72 plat->dma_cfg->pbl = 16;
73 plat->dma_cfg->burst_len = DMA_AXI_BLEN_256;
74 plat->dma_cfg->fixed_burst = 1;
75
76 /* Set default value for multicast hash bins */
77 plat->multicast_filter_bins = HASH_TABLE_SIZE;
78
79 /* Set default value for unicast filter entries */
80 plat->unicast_filter_entries = 1;
81
82 return 0;
83}
84
85static struct stmmac_pci_info quark_pci_info = {
86 .setup = quark_default_data,
87};
88
51/** 89/**
52 * stmmac_pci_probe 90 * stmmac_pci_probe
53 * 91 *
@@ -63,6 +101,7 @@ static void stmmac_default_data(struct plat_stmmacenet_data *plat)
63static int stmmac_pci_probe(struct pci_dev *pdev, 101static int stmmac_pci_probe(struct pci_dev *pdev,
64 const struct pci_device_id *id) 102 const struct pci_device_id *id)
65{ 103{
104 struct stmmac_pci_info *info = (struct stmmac_pci_info *)id->driver_data;
66 struct plat_stmmacenet_data *plat; 105 struct plat_stmmacenet_data *plat;
67 struct stmmac_priv *priv; 106 struct stmmac_priv *priv;
68 int i; 107 int i;
@@ -103,7 +142,15 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
103 142
104 pci_set_master(pdev); 143 pci_set_master(pdev);
105 144
106 stmmac_default_data(plat); 145 if (info) {
146 info->pdev = pdev;
147 if (info->setup) {
148 ret = info->setup(plat, info);
149 if (ret)
150 return ret;
151 }
152 } else
153 stmmac_default_data(plat);
107 154
108 priv = stmmac_dvr_probe(&pdev->dev, plat, pcim_iomap_table(pdev)[i]); 155 priv = stmmac_dvr_probe(&pdev->dev, plat, pcim_iomap_table(pdev)[i]);
109 if (IS_ERR(priv)) { 156 if (IS_ERR(priv)) {
@@ -155,11 +202,13 @@ static int stmmac_pci_resume(struct device *dev)
155static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume); 202static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume);
156 203
157#define STMMAC_VENDOR_ID 0x700 204#define STMMAC_VENDOR_ID 0x700
205#define STMMAC_QUARK_ID 0x0937
158#define STMMAC_DEVICE_ID 0x1108 206#define STMMAC_DEVICE_ID 0x1108
159 207
160static const struct pci_device_id stmmac_id_table[] = { 208static const struct pci_device_id stmmac_id_table[] = {
161 {PCI_DEVICE(STMMAC_VENDOR_ID, STMMAC_DEVICE_ID)}, 209 {PCI_DEVICE(STMMAC_VENDOR_ID, STMMAC_DEVICE_ID)},
162 {PCI_DEVICE(PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_MAC)}, 210 {PCI_DEVICE(PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_MAC)},
211 {PCI_VDEVICE(INTEL, STMMAC_QUARK_ID), (kernel_ulong_t)&quark_pci_info},
163 {} 212 {}
164}; 213};
165 214