kernel: update 4.0 to 4.0.5
[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 --- a/arch/mips/bcm47xx/board.c
43 +++ b/arch/mips/bcm47xx/board.c
44 @@ -1,8 +1,8 @@
45  #include <linux/errno.h>
46  #include <linux/export.h>
47  #include <linux/string.h>
48 +#include <bcm47xx.h>
49  #include <bcm47xx_board.h>
50 -#include <bcm47xx_nvram.h>
51  
52  struct bcm47xx_board_type {
53         const enum bcm47xx_board board;
54 --- a/arch/mips/bcm47xx/nvram.c
55 +++ b/arch/mips/bcm47xx/nvram.c
56 @@ -16,7 +16,7 @@
57  #include <linux/kernel.h>
58  #include <linux/string.h>
59  #include <linux/mtd/mtd.h>
60 -#include <bcm47xx_nvram.h>
61 +#include <linux/bcm47xx_nvram.h>
62  
63  #define NVRAM_MAGIC            0x48534C46      /* 'FLSH' */
64  #define NVRAM_SPACE            0x8000
65 --- a/arch/mips/bcm47xx/setup.c
66 +++ b/arch/mips/bcm47xx/setup.c
67 @@ -42,7 +42,6 @@
68  #include <asm/reboot.h>
69  #include <asm/time.h>
70  #include <bcm47xx.h>
71 -#include <bcm47xx_nvram.h>
72  #include <bcm47xx_board.h>
73  
74  union bcm47xx_bus bcm47xx_bus;
75 --- a/arch/mips/bcm47xx/sprom.c
76 +++ b/arch/mips/bcm47xx/sprom.c
77 @@ -27,7 +27,6 @@
78   */
79  
80  #include <bcm47xx.h>
81 -#include <bcm47xx_nvram.h>
82  #include <linux/if_ether.h>
83  #include <linux/etherdevice.h>
84  
85 --- a/arch/mips/bcm47xx/time.c
86 +++ b/arch/mips/bcm47xx/time.c
87 @@ -27,7 +27,6 @@
88  #include <linux/ssb/ssb.h>
89  #include <asm/time.h>
90  #include <bcm47xx.h>
91 -#include <bcm47xx_nvram.h>
92  #include <bcm47xx_board.h>
93  
94  void __init plat_time_init(void)
95 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
96 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
97 @@ -22,6 +22,7 @@
98  #include <linux/ssb/ssb.h>
99  #include <linux/bcma/bcma.h>
100  #include <linux/bcma/bcma_soc.h>
101 +#include <linux/bcm47xx_nvram.h>
102  
103  enum bcm47xx_bus_type {
104  #ifdef CONFIG_BCM47XX_SSB
105 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
106 +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
107 @@ -1,21 +1 @@
108 -/*
109 - *  Copyright (C) 2005, Broadcom Corporation
110 - *  Copyright (C) 2006, Felix Fietkau <nbd@openwrt.org>
111 - *
112 - *  This program is free software; you can redistribute  it and/or modify it
113 - *  under  the terms of  the GNU General  Public License as published by the
114 - *  Free Software Foundation;  either version 2 of the  License, or (at your
115 - *  option) any later version.
116 - */
117 -
118 -#ifndef __BCM47XX_NVRAM_H
119 -#define __BCM47XX_NVRAM_H
120 -
121 -#include <linux/types.h>
122 -#include <linux/kernel.h>
123 -
124 -int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
125 -int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
126 -int bcm47xx_nvram_gpio_pin(const char *name);
127 -
128 -#endif /* __BCM47XX_NVRAM_H */
129 +#include <linux/bcm47xx_nvram.h>
130 --- a/drivers/bcma/driver_mips.c
131 +++ b/drivers/bcma/driver_mips.c
132 @@ -21,7 +21,7 @@
133  #include <linux/serial_reg.h>
134  #include <linux/time.h>
135  #ifdef CONFIG_BCM47XX
136 -#include <bcm47xx_nvram.h>
137 +#include <linux/bcm47xx_nvram.h>
138  #endif
139  
140  enum bcma_boot_dev {
141 --- a/drivers/net/ethernet/broadcom/b44.c
142 +++ b/drivers/net/ethernet/broadcom/b44.c
143 @@ -400,7 +400,7 @@ static void b44_set_flow_ctrl(struct b44
144  }
145  
146  #ifdef CONFIG_BCM47XX
147 -#include <bcm47xx_nvram.h>
148 +#include <linux/bcm47xx_nvram.h>
149  static void b44_wap54g10_workaround(struct b44 *bp)
150  {
151         char buf[20];
152 --- a/drivers/net/ethernet/broadcom/bgmac.c
153 +++ b/drivers/net/ethernet/broadcom/bgmac.c
154 @@ -18,7 +18,7 @@
155  #include <linux/interrupt.h>
156  #include <linux/dma-mapping.h>
157  #include <linux/platform_data/b53.h>
158 -#include <bcm47xx_nvram.h>
159 +#include <linux/bcm47xx_nvram.h>
160  
161  static const struct bcma_device_id bgmac_bcma_tbl[] = {
162         BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
163 --- a/drivers/ssb/driver_chipcommon_pmu.c
164 +++ b/drivers/ssb/driver_chipcommon_pmu.c
165 @@ -14,7 +14,7 @@
166  #include <linux/delay.h>
167  #include <linux/export.h>
168  #ifdef CONFIG_BCM47XX
169 -#include <bcm47xx_nvram.h>
170 +#include <linux/bcm47xx_nvram.h>
171  #endif
172  
173  #include "ssb_private.h"
174 --- a/drivers/ssb/driver_mipscore.c
175 +++ b/drivers/ssb/driver_mipscore.c
176 @@ -16,7 +16,7 @@
177  #include <linux/serial_reg.h>
178  #include <linux/time.h>
179  #ifdef CONFIG_BCM47XX
180 -#include <bcm47xx_nvram.h>
181 +#include <linux/bcm47xx_nvram.h>
182  #endif
183  
184  #include "ssb_private.h"
185 --- /dev/null
186 +++ b/include/linux/bcm47xx_nvram.h
187 @@ -0,0 +1,34 @@
188 +/*
189 + *  This program is free software; you can redistribute  it and/or modify it
190 + *  under  the terms of  the GNU General  Public License as published by the
191 + *  Free Software Foundation;  either version 2 of the  License, or (at your
192 + *  option) any later version.
193 + */
194 +
195 +#ifndef __BCM47XX_NVRAM_H
196 +#define __BCM47XX_NVRAM_H
197 +
198 +#include <linux/types.h>
199 +#include <linux/kernel.h>
200 +
201 +#ifdef CONFIG_BCM47XX
202 +int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
203 +int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
204 +int bcm47xx_nvram_gpio_pin(const char *name);
205 +#else
206 +static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
207 +{
208 +       return -ENOTSUPP;
209 +};
210 +static inline int bcm47xx_nvram_getenv(const char *name, char *val,
211 +                                      size_t val_len)
212 +{
213 +       return -ENOTSUPP;
214 +};
215 +static inline int bcm47xx_nvram_gpio_pin(const char *name)
216 +{
217 +       return -ENOTSUPP;
218 +};
219 +#endif
220 +
221 +#endif /* __BCM47XX_NVRAM_H */