brcm47xx: add patches for kernel 4.0
[openwrt.git] / target / linux / brcm47xx / patches-4.0 / 030-05-MIPS-BCM47xx-Move-NVRAM-header-to-the-include-linux.patch
1 From 138173d4e826587da66c7d321da1a91283222536 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Mon, 1 Dec 2014 07:58:18 +0100
4 Subject: [PATCH] MIPS: BCM47xx: Move NVRAM header to the include/linux/.
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 There are two reasons for having this header in the common place:
10 1) Simplifying drivers that read NVRAM entries. We will be able to
11    safely call bcm47xx_nvram_* functions without #ifdef-s.
12 2) Getting NVRAM driver out of MIPS arch code. This is needed to support
13    BCM5301X arch which also requires this NVRAM driver. Patch for that
14    will follow once we get is reviewed.
15
16 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
17 Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
18 Cc: linux-mips@linux-mips.org
19 Cc: Arnd Bergmann <arnd@arndb.de>
20 Cc: Paul Walmsley <paul@pwsan.com>
21 Cc: linux-soc@vger.kernel.org
22 Patchwork: https://patchwork.linux-mips.org/patch/8619/
23 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
24 ---
25  arch/mips/bcm47xx/board.c                          |  2 +-
26  arch/mips/bcm47xx/nvram.c                          |  2 +-
27  arch/mips/bcm47xx/setup.c                          |  1 -
28  arch/mips/bcm47xx/sprom.c                          |  1 -
29  arch/mips/bcm47xx/time.c                           |  1 -
30  arch/mips/include/asm/mach-bcm47xx/bcm47xx.h       |  1 +
31  arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h | 21 -------------
32  drivers/bcma/driver_mips.c                         |  2 +-
33  drivers/net/ethernet/broadcom/b44.c                |  2 +-
34  drivers/net/ethernet/broadcom/bgmac.c              |  2 +-
35  drivers/ssb/driver_chipcommon_pmu.c                |  2 +-
36  drivers/ssb/driver_mipscore.c                      |  2 +-
37  include/linux/bcm47xx_nvram.h                      | 34 ++++++++++++++++++++++
38  13 files changed, 42 insertions(+), 31 deletions(-)
39  delete mode 100644 arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
40  create mode 100644 include/linux/bcm47xx_nvram.h
41
42 diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
43 index b3ae068..6e85130 100644
44 --- a/arch/mips/bcm47xx/board.c
45 +++ b/arch/mips/bcm47xx/board.c
46 @@ -1,8 +1,8 @@
47  #include <linux/errno.h>
48  #include <linux/export.h>
49  #include <linux/string.h>
50 +#include <bcm47xx.h>
51  #include <bcm47xx_board.h>
52 -#include <bcm47xx_nvram.h>
53  
54  struct bcm47xx_board_type {
55         const enum bcm47xx_board board;
56 diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
57 index d805d8a..7c77a88 100644
58 --- a/arch/mips/bcm47xx/nvram.c
59 +++ b/arch/mips/bcm47xx/nvram.c
60 @@ -16,7 +16,7 @@
61  #include <linux/kernel.h>
62  #include <linux/string.h>
63  #include <linux/mtd/mtd.h>
64 -#include <bcm47xx_nvram.h>
65 +#include <linux/bcm47xx_nvram.h>
66  
67  #define NVRAM_MAGIC            0x48534C46      /* 'FLSH' */
68  #define NVRAM_SPACE            0x8000
69 diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
70 index e43b504..b26c9c2 100644
71 --- a/arch/mips/bcm47xx/setup.c
72 +++ b/arch/mips/bcm47xx/setup.c
73 @@ -42,7 +42,6 @@
74  #include <asm/reboot.h>
75  #include <asm/time.h>
76  #include <bcm47xx.h>
77 -#include <bcm47xx_nvram.h>
78  #include <bcm47xx_board.h>
79  
80  union bcm47xx_bus bcm47xx_bus;
81 diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
82 index eff9205..c114b02 100644
83 --- a/arch/mips/bcm47xx/sprom.c
84 +++ b/arch/mips/bcm47xx/sprom.c
85 @@ -27,7 +27,6 @@
86   */
87  
88  #include <bcm47xx.h>
89 -#include <bcm47xx_nvram.h>
90  #include <linux/if_ether.h>
91  #include <linux/etherdevice.h>
92  
93 diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
94 index 2c85d92..5b46510 100644
95 --- a/arch/mips/bcm47xx/time.c
96 +++ b/arch/mips/bcm47xx/time.c
97 @@ -27,7 +27,6 @@
98  #include <linux/ssb/ssb.h>
99  #include <asm/time.h>
100  #include <bcm47xx.h>
101 -#include <bcm47xx_nvram.h>
102  #include <bcm47xx_board.h>
103  
104  void __init plat_time_init(void)
105 diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
106 index 7527c1d..8ed77f6 100644
107 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
108 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
109 @@ -22,6 +22,7 @@
110  #include <linux/ssb/ssb.h>
111  #include <linux/bcma/bcma.h>
112  #include <linux/bcma/bcma_soc.h>
113 +#include <linux/bcm47xx_nvram.h>
114  
115  enum bcm47xx_bus_type {
116  #ifdef CONFIG_BCM47XX_SSB
117 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
118 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
119 @@ -1,21 +1 @@
120 -/*
121 - *  Copyright (C) 2005, Broadcom Corporation
122 - *  Copyright (C) 2006, Felix Fietkau <nbd@openwrt.org>
123 - *
124 - *  This program is free software; you can redistribute  it and/or modify it
125 - *  under  the terms of  the GNU General  Public License as published by the
126 - *  Free Software Foundation;  either version 2 of the  License, or (at your
127 - *  option) any later version.
128 - */
129 -
130 -#ifndef __BCM47XX_NVRAM_H
131 -#define __BCM47XX_NVRAM_H
132 -
133 -#include <linux/types.h>
134 -#include <linux/kernel.h>
135 -
136 -int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
137 -int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
138 -int bcm47xx_nvram_gpio_pin(const char *name);
139 -
140 -#endif /* __BCM47XX_NVRAM_H */
141 +#include <linux/bcm47xx_nvram.h>
142 diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
143 index 04faf6d..24424f3 100644
144 --- a/drivers/bcma/driver_mips.c
145 +++ b/drivers/bcma/driver_mips.c
146 @@ -21,7 +21,7 @@
147  #include <linux/serial_reg.h>
148  #include <linux/time.h>
149  #ifdef CONFIG_BCM47XX
150 -#include <bcm47xx_nvram.h>
151 +#include <linux/bcm47xx_nvram.h>
152  #endif
153  
154  enum bcma_boot_dev {
155 diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
156 index bd5916a..77363d6 100644
157 --- a/drivers/net/ethernet/broadcom/b44.c
158 +++ b/drivers/net/ethernet/broadcom/b44.c
159 @@ -400,7 +400,7 @@ static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote)
160  }
161  
162  #ifdef CONFIG_BCM47XX
163 -#include <bcm47xx_nvram.h>
164 +#include <linux/bcm47xx_nvram.h>
165  static void b44_wap54g10_workaround(struct b44 *bp)
166  {
167         char buf[20];
168 diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
169 index 0469f72..be059df 100644
170 --- a/drivers/net/ethernet/broadcom/bgmac.c
171 +++ b/drivers/net/ethernet/broadcom/bgmac.c
172 @@ -18,7 +18,7 @@
173  #include <linux/interrupt.h>
174  #include <linux/dma-mapping.h>
175  #include <linux/platform_data/b53.h>
176 -#include <bcm47xx_nvram.h>
177 +#include <linux/bcm47xx_nvram.h>
178  
179  static const struct bcma_device_id bgmac_bcma_tbl[] = {
180         BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
181 diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c
182 index 1173a09..0942841 100644
183 --- a/drivers/ssb/driver_chipcommon_pmu.c
184 +++ b/drivers/ssb/driver_chipcommon_pmu.c
185 @@ -14,7 +14,7 @@
186  #include <linux/delay.h>
187  #include <linux/export.h>
188  #ifdef CONFIG_BCM47XX
189 -#include <bcm47xx_nvram.h>
190 +#include <linux/bcm47xx_nvram.h>
191  #endif
192  
193  #include "ssb_private.h"
194 diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
195 index 7b986f9..f87efef 100644
196 --- a/drivers/ssb/driver_mipscore.c
197 +++ b/drivers/ssb/driver_mipscore.c
198 @@ -16,7 +16,7 @@
199  #include <linux/serial_reg.h>
200  #include <linux/time.h>
201  #ifdef CONFIG_BCM47XX
202 -#include <bcm47xx_nvram.h>
203 +#include <linux/bcm47xx_nvram.h>
204  #endif
205  
206  #include "ssb_private.h"
207 diff --git a/include/linux/bcm47xx_nvram.h b/include/linux/bcm47xx_nvram.h
208 new file mode 100644
209 index 0000000..b12b07e
210 --- /dev/null
211 +++ b/include/linux/bcm47xx_nvram.h
212 @@ -0,0 +1,34 @@
213 +/*
214 + *  This program is free software; you can redistribute  it and/or modify it
215 + *  under  the terms of  the GNU General  Public License as published by the
216 + *  Free Software Foundation;  either version 2 of the  License, or (at your
217 + *  option) any later version.
218 + */
219 +
220 +#ifndef __BCM47XX_NVRAM_H
221 +#define __BCM47XX_NVRAM_H
222 +
223 +#include <linux/types.h>
224 +#include <linux/kernel.h>
225 +
226 +#ifdef CONFIG_BCM47XX
227 +int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
228 +int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
229 +int bcm47xx_nvram_gpio_pin(const char *name);
230 +#else
231 +static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
232 +{
233 +       return -ENOTSUPP;
234 +};
235 +static inline int bcm47xx_nvram_getenv(const char *name, char *val,
236 +                                      size_t val_len)
237 +{
238 +       return -ENOTSUPP;
239 +};
240 +static inline int bcm47xx_nvram_gpio_pin(const char *name)
241 +{
242 +       return -ENOTSUPP;
243 +};
244 +#endif
245 +
246 +#endif /* __BCM47XX_NVRAM_H */
247 -- 
248 1.8.4.5
249