13 #include <linux/export.h>
14 #include <linux/pci.h>
16 #include <linux/slab.h>
34 return ssb_read8(dev->dev, offset);
39 return ssb_read16(dev->dev, offset);
44 return ssb_read32(dev->dev, offset);
47 static inline void gige_write8(
struct ssb_gige *
dev,
50 ssb_write8(dev->dev, offset, value);
53 static inline void gige_write16(
struct ssb_gige *
dev,
56 ssb_write16(dev->dev, offset, value);
59 static inline void gige_write32(
struct ssb_gige *
dev,
62 ssb_write32(dev->dev, offset, value);
66 u8 gige_pcicfg_read8(
struct ssb_gige *
dev,
unsigned int offset)
69 return gige_read8(dev, SSB_GIGE_PCICFG + offset);
73 u16 gige_pcicfg_read16(
struct ssb_gige *
dev,
unsigned int offset)
76 return gige_read16(dev, SSB_GIGE_PCICFG + offset);
80 u32 gige_pcicfg_read32(
struct ssb_gige *
dev,
unsigned int offset)
83 return gige_read32(dev, SSB_GIGE_PCICFG + offset);
87 void gige_pcicfg_write8(
struct ssb_gige *
dev,
91 gige_write8(dev, SSB_GIGE_PCICFG + offset, value);
95 void gige_pcicfg_write16(
struct ssb_gige *
dev,
99 gige_write16(dev, SSB_GIGE_PCICFG + offset, value);
103 void gige_pcicfg_write32(
struct ssb_gige *
dev,
107 gige_write32(dev, SSB_GIGE_PCICFG + offset, value);
125 *val = gige_pcicfg_read8(dev, reg);
128 *val = gige_pcicfg_read16(dev, reg);
131 *val = gige_pcicfg_read32(dev, reg);
136 spin_unlock_irqrestore(&dev->lock, flags);
142 unsigned int devfn,
int reg,
156 gige_pcicfg_write8(dev, reg, val);
159 gige_pcicfg_write16(dev, reg, val);
162 gige_pcicfg_write32(dev, reg, val);
167 spin_unlock_irqrestore(&dev->lock, flags);
175 struct ssb_gige *
dev;
184 dev->pci_controller.pci_ops = &dev->pci_ops;
185 dev->pci_controller.io_resource = &dev->io_resource;
186 dev->pci_controller.mem_resource = &dev->mem_resource;
187 dev->pci_controller.io_map_base = 0x800;
188 dev->pci_ops.read = ssb_gige_pci_read_config;
189 dev->pci_ops.write = ssb_gige_pci_write_config;
191 dev->io_resource.name = SSB_GIGE_IO_RES_NAME;
192 dev->io_resource.start = 0x800;
193 dev->io_resource.end = 0x8FF;
204 dev->mem_resource.name = SSB_GIGE_MEM_RES_NAME;
205 dev->mem_resource.start = base;
206 dev->mem_resource.end = base + 0x10000 - 1;
220 gige_write32(dev, SSB_GIGE_SHIM_FLUSHSTAT, 0x00000068);
226 if (tmshigh & SSB_GIGE_TMSHIGH_RGMII) {
227 tmslow &= ~SSB_GIGE_TMSLOW_TXBYPASS;
228 tmslow &= ~SSB_GIGE_TMSLOW_RXBYPASS;
231 tmslow |= SSB_GIGE_TMSLOW_TXBYPASS;
232 tmslow |= SSB_GIGE_TMSLOW_RXBYPASS;
235 tmslow |= SSB_GIGE_TMSLOW_DLLEN;
238 ssb_set_drvdata(sdev, dev);
248 return (
strcmp(pdev->
resource[0].name, SSB_GIGE_MEM_RES_NAME) == 0);
255 struct ssb_gige *dev = ssb_get_drvdata(sdev);
258 if (pdev->
bus->ops != &dev->pci_ops) {
266 res->
name = dev->mem_resource.name;
267 res->
start = dev->mem_resource.start;
268 res->
end = dev->mem_resource.end;
280 struct ssb_gige *dev = ssb_get_drvdata(sdev);
282 if (pdev->
bus->ops != &dev->pci_ops) {
292 .id_table = ssb_gige_tbl,
293 .probe = ssb_gige_probe,