You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openwrt/target/linux/bcm63xx/patches-5.4/357-MIPS-BCM63XX-use-platfo...

96 lines
3.1 KiB
Diff

From 9912a8b3c240a9b0af01ff496b7e8ed9e4cc5b82 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
Date: Tue, 29 Jul 2014 21:43:49 +0200
Subject: [PATCH 02/10] MIPS: BCM63XX: use platform data for the sprom
Similar to ethernet setup, use a platform data struct for passing
the mac. This eliminates the requirement to allocate an array on
stack for the mac passed.
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
arch/mips/bcm63xx/boards/board_common.c | 6 ++----
arch/mips/bcm63xx/sprom.c | 8 ++++----
arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 +++++++-
arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 4 ++++
4 files changed, 17 insertions(+), 9 deletions(-)
--- a/arch/mips/bcm63xx/boards/board_common.c
+++ b/arch/mips/bcm63xx/boards/board_common.c
@@ -141,7 +141,6 @@ static struct platform_device bcm63xx_gp
int __init board_register_devices(void)
{
int usbh_ports = 0;
- u8 mac[ETH_ALEN];
if (board.has_uart0)
bcm63xx_uart_register(0);
@@ -184,8 +183,8 @@ int __init board_register_devices(void)
* do this after registering enet devices
*/
- if (board_get_mac_address(mac) ||
- bcm63xx_register_fallback_sprom(mac))
+ if (board_get_mac_address(board.fallback_sprom.mac_addr) ||
+ bcm63xx_register_fallback_sprom(&board.fallback_sprom))
pr_err(PFX "failed to register fallback SPROM\n");
bcm63xx_spi_register();
--- a/arch/mips/bcm63xx/sprom.c
+++ b/arch/mips/bcm63xx/sprom.c
@@ -55,14 +55,14 @@ int bcm63xx_get_fallback_sprom(struct ss
}
#endif
-int __init bcm63xx_register_fallback_sprom(u8 *mac)
+int __init bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data)
{
int ret = 0;
#ifdef CONFIG_SSB_PCIHOST
- memcpy(bcm63xx_sprom.il0mac, mac, ETH_ALEN);
- memcpy(bcm63xx_sprom.et0mac, mac, ETH_ALEN);
- memcpy(bcm63xx_sprom.et1mac, mac, ETH_ALEN);
+ memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN);
+ memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN);
+ memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN);
ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom);
#endif
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
@@ -1,6 +1,12 @@
#ifndef __BCM63XX_FALLBACK_SPROM
#define __BCM63XX_FALLBACK_SPROM
-int bcm63xx_register_fallback_sprom(u8 *mac);
+#include <linux/if_ether.h>
+
+struct fallback_sprom_data {
+ u8 mac_addr[ETH_ALEN];
+};
+
+int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data);
#endif
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
@@ -7,6 +7,7 @@
#include <linux/leds.h>
#include <bcm63xx_dev_enet.h>
#include <bcm63xx_dev_usb_usbd.h>
+#include <bcm63xx_fallback_sprom.h>
/*
* flash mapping
@@ -50,6 +51,9 @@ struct board_info {
/* External PHY reset GPIO flags from gpio.h */
unsigned long ephy_reset_gpio_flags;
+
+ /* fallback sprom config */
+ struct fallback_sprom_data fallback_sprom;
};
#endif /* ! BOARD_BCM963XX_H_ */