summaryrefslogtreecommitdiff
path: root/target/linux/brcm63xx/patches-3.14/357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch
blob: bc35c251650a4dcc76f5f043c20112a2cec582cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
@@ -157,7 +157,6 @@ int __init board_register_devices(void)
 	int button_count = 0;
 	int led_count = 0;
 	int usbh_ports = 0;
-	u8 mac[ETH_ALEN];
 
 	if (board.has_uart0)
 		bcm63xx_uart_register(0);
@@ -203,8 +202,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
@@ -8,6 +8,7 @@
 #include <bcm63xx_dev_enet.h>
 #include <bcm63xx_dev_usb_usbd.h>
 #include <bcm63xx_dev_dsp.h>
+#include <bcm63xx_fallback_sprom.h>
 
 /*
  * flash mapping
@@ -59,6 +60,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;
+
 	/* Additional platform devices */
 	struct platform_device **devs;
 	unsigned int	num_devs;