Commit 3f84622d authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by Ralf Baechle

SSB: Fix nvram_get on BCM47xx platform

The nvram_get function was never in the mainline kernel, it only existed in
an external OpenWrt patch. Use nvram_getenv function, which is in mainline
and use an include instead of an extra function declaration.  et0macaddr
contains the mac address in text from like 00:11:22:33:44:55. We have to
parse it before adding it into macaddr.

nvram_parse_macaddr will be merged into asm/mach-bcm47xx/nvram.h through
the MIPS git tree and will be available soon. It will not build now without
nvram_parse_macaddr, but it hasn't before either.
Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
To: linux-mips@linux-mips.org
Cc: mb@bu3sch.de
Cc: netdev@vger.kernel.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Acked-by: default avatarMichael Buesch <mb@bu3sch.de>
Patchwork: https://patchwork.linux-mips.org/patch/1849/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 1690a7f9
...@@ -96,16 +96,21 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev) ...@@ -96,16 +96,21 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
return 0; return 0;
} }
extern char * nvram_get(const char *name); #ifdef CONFIG_BCM47XX
#include <asm/mach-bcm47xx/nvram.h>
/* Get the device MAC address */ /* Get the device MAC address */
static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
{ {
#ifdef CONFIG_BCM47XX char buf[20];
char *res = nvram_get("et0macaddr"); if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
if (res) return;
memcpy(macaddr, res, 6); nvram_parse_macaddr(buf, macaddr);
#endif
} }
#else
static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
{
}
#endif
extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
struct pci_dev *pdev); struct pci_dev *pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment