aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2013-02-07 00:37:37 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-07 23:47:01 -0500
commit180996c30517b5374f63df3c9765716c5b477155 (patch)
tree0fad019ca8b54e226a8c5a6e48fc476d9f33b757 /include
parent241448c2b84ff02a46ce88199e05fdeb55bad449 (diff)
ssb: get mac address from sprom struct for gige driver
The mac address is already stored in the sprom structure by the platform code of the SoC this Ethernet core is found on, it just has to be fetched from this structure instead of accessing the nvram here. This patch also adds a return value to indicate if a mac address could be fetched from the sprom structure. When CONFIG_SSB_DRIVER_GIGE is not set the header file now also declares ssb_gige_get_macaddr(). Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Michael Buesch <m@bues.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ssb/ssb_driver_gige.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 6b05dcd927ff..86a12b0cb239 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -97,21 +97,16 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
97 return 0; 97 return 0;
98} 98}
99 99
100#ifdef CONFIG_BCM47XX
101#include <asm/mach-bcm47xx/nvram.h>
102/* Get the device MAC address */ 100/* Get the device MAC address */
103static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 101static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
104{
105 char buf[20];
106 if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
107 return;
108 nvram_parse_macaddr(buf, macaddr);
109}
110#else
111static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
112{ 102{
103 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
104 if (!dev)
105 return -ENODEV;
106
107 memcpy(macaddr, dev->dev->bus->sprom.et0mac, 6);
108 return 0;
113} 109}
114#endif
115 110
116extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, 111extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
117 struct pci_dev *pdev); 112 struct pci_dev *pdev);
@@ -175,6 +170,10 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
175{ 170{
176 return 0; 171 return 0;
177} 172}
173static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
174{
175 return -ENODEV;
176}
178 177
179#endif /* CONFIG_SSB_DRIVER_GIGE */ 178#endif /* CONFIG_SSB_DRIVER_GIGE */
180#endif /* LINUX_SSB_DRIVER_GIGE_H_ */ 179#endif /* LINUX_SSB_DRIVER_GIGE_H_ */