brcm63xx: add linux 4.4 support
[openwrt.git] / target / linux / brcm63xx / patches-4.4 / 357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch
1 From 9912a8b3c240a9b0af01ff496b7e8ed9e4cc5b82 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Tue, 29 Jul 2014 21:43:49 +0200
4 Subject: [PATCH 02/10] MIPS: BCM63XX: use platform data for the sprom
5
6 Similar to ethernet setup, use a platform data struct for passing
7 the mac. This eliminates the requirement to allocate an array on
8 stack for the mac passed.
9
10 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
11 ---
12  arch/mips/bcm63xx/boards/board_common.c                     | 6 ++----
13  arch/mips/bcm63xx/sprom.c                                   | 8 ++++----
14  arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 +++++++-
15  arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h         | 4 ++++
16  4 files changed, 17 insertions(+), 9 deletions(-)
17
18 --- a/arch/mips/bcm63xx/boards/board_common.c
19 +++ b/arch/mips/bcm63xx/boards/board_common.c
20 @@ -143,7 +143,6 @@ static struct platform_device bcm63xx_gp
21  int __init board_register_devices(void)
22  {
23         int usbh_ports = 0;
24 -       u8 mac[ETH_ALEN];
25  
26         if (board.has_uart0)
27                 bcm63xx_uart_register(0);
28 @@ -189,8 +188,8 @@ int __init board_register_devices(void)
29          * do this after registering enet devices
30          */
31  
32 -       if (board_get_mac_address(mac) ||
33 -           bcm63xx_register_fallback_sprom(mac))
34 +       if (board_get_mac_address(board.fallback_sprom.mac_addr) ||
35 +           bcm63xx_register_fallback_sprom(&board.fallback_sprom))
36                 pr_err(PFX "failed to register fallback SPROM\n");
37  
38         bcm63xx_spi_register();
39 --- a/arch/mips/bcm63xx/sprom.c
40 +++ b/arch/mips/bcm63xx/sprom.c
41 @@ -55,14 +55,14 @@ int bcm63xx_get_fallback_sprom(struct ss
42  }
43  #endif
44  
45 -int __init bcm63xx_register_fallback_sprom(u8 *mac)
46 +int __init bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data)
47  {
48         int ret = 0;
49  
50  #ifdef CONFIG_SSB_PCIHOST
51 -       memcpy(bcm63xx_sprom.il0mac, mac, ETH_ALEN);
52 -       memcpy(bcm63xx_sprom.et0mac, mac, ETH_ALEN);
53 -       memcpy(bcm63xx_sprom.et1mac, mac, ETH_ALEN);
54 +       memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN);
55 +       memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN);
56 +       memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN);
57  
58         ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom);
59  #endif
60 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
61 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h
62 @@ -1,6 +1,12 @@
63  #ifndef __BCM63XX_FALLBACK_SPROM
64  #define __BCM63XX_FALLBACK_SPROM
65  
66 -int bcm63xx_register_fallback_sprom(u8 *mac);
67 +#include <linux/if_ether.h>
68 +
69 +struct fallback_sprom_data {
70 +       u8 mac_addr[ETH_ALEN];
71 +};
72 +
73 +int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data);
74  
75  #endif
76 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
77 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
78 @@ -7,6 +7,7 @@
79  #include <bcm63xx_dev_enet.h>
80  #include <bcm63xx_dev_usb_usbd.h>
81  #include <bcm63xx_dev_dsp.h>
82 +#include <bcm63xx_fallback_sprom.h>
83  
84  /*
85   * flash mapping
86 @@ -55,6 +56,9 @@ struct board_info {
87         /* External PHY reset GPIO flags from gpio.h */
88         unsigned long ephy_reset_gpio_flags;
89  
90 +       /* fallback sprom config */
91 +       struct fallback_sprom_data fallback_sprom;
92 +
93         /* Additional platform devices */
94         struct platform_device **devs;
95         unsigned int    num_devs;