bcm53xx: move NVRAM header to the target files
[15.05/openwrt.git] / target / linux / bcm53xx / patches-3.18 / 110-bcm47xx-move-the-nvram-header-file-into-common-space.patch
1 From 7063a1583166abe1a9cefed38c2f53a0e14a0005 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sun, 4 May 2014 16:35:42 +0200
4 Subject: [PATCH 01/17] MIPS: BCM47XX: move the nvram header file into common
5  space
6
7 Moving mach-bcm47xx/bcm47xx_nvram.h to include/linux/bcm47xx_nvram.h
8 makes it possible to reuse this header on the ARM based bcm47xx/bcm53xx
9 SoCs (e.g. BCM5301X devices). Broadcom uses ARM CPUs in their new SoC
10 form the bcm47xx and bcm53xx line, but many other things like nvram
11 stayed the same.
12
13 This is a preparation for adding a new nvram driver, which can be used
14 by the ARM SoC and the MIPS SoC code. The device drivers accessing
15 nvram do not have to care about ARM or MIPS SoC version.
16
17 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
18 ---
19  arch/mips/bcm47xx/board.c                          |  2 +-
20  arch/mips/bcm47xx/nvram.c                          |  2 +-
21  arch/mips/bcm47xx/setup.c                          |  2 +-
22  arch/mips/bcm47xx/sprom.c                          |  2 +-
23  arch/mips/bcm47xx/time.c                           |  2 +-
24  arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h | 53 -----------------
25  drivers/net/ethernet/broadcom/b44.c                |  8 +--
26  drivers/net/ethernet/broadcom/bgmac.c              |  2 +-
27  drivers/ssb/driver_chipcommon_pmu.c                |  6 +-
28  include/linux/bcm47xx_nvram.h                      | 66 ++++++++++++++++++++++
29  10 files changed, 74 insertions(+), 71 deletions(-)
30  delete mode 100644 arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
31  create mode 100644 include/linux/bcm47xx_nvram.h
32
33 --- a/arch/mips/bcm47xx/board.c
34 +++ b/arch/mips/bcm47xx/board.c
35 @@ -2,7 +2,7 @@
36  #include <linux/export.h>
37  #include <linux/string.h>
38  #include <bcm47xx_board.h>
39 -#include <bcm47xx_nvram.h>
40 +#include <linux/bcm47xx_nvram.h>
41  
42  struct bcm47xx_board_type {
43         const enum bcm47xx_board board;
44 --- a/arch/mips/bcm47xx/nvram.c
45 +++ b/arch/mips/bcm47xx/nvram.c
46 @@ -17,7 +17,7 @@
47  #include <linux/kernel.h>
48  #include <linux/string.h>
49  #include <asm/addrspace.h>
50 -#include <bcm47xx_nvram.h>
51 +#include <linux/bcm47xx_nvram.h>
52  #include <asm/mach-bcm47xx/bcm47xx.h>
53  
54  static char nvram_buf[NVRAM_SPACE];
55 --- a/arch/mips/bcm47xx/setup.c
56 +++ b/arch/mips/bcm47xx/setup.c
57 @@ -42,7 +42,7 @@
58  #include <asm/reboot.h>
59  #include <asm/time.h>
60  #include <bcm47xx.h>
61 -#include <bcm47xx_nvram.h>
62 +#include <linux/bcm47xx_nvram.h>
63  #include <bcm47xx_board.h>
64  
65  union bcm47xx_bus bcm47xx_bus;
66 --- a/arch/mips/bcm47xx/sprom.c
67 +++ b/arch/mips/bcm47xx/sprom.c
68 @@ -27,7 +27,7 @@
69   */
70  
71  #include <bcm47xx.h>
72 -#include <bcm47xx_nvram.h>
73 +#include <linux/bcm47xx_nvram.h>
74  #include <linux/if_ether.h>
75  #include <linux/etherdevice.h>
76  
77 --- a/arch/mips/bcm47xx/time.c
78 +++ b/arch/mips/bcm47xx/time.c
79 @@ -27,7 +27,7 @@
80  #include <linux/ssb/ssb.h>
81  #include <asm/time.h>
82  #include <bcm47xx.h>
83 -#include <bcm47xx_nvram.h>
84 +#include <linux/bcm47xx_nvram.h>
85  #include <bcm47xx_board.h>
86  
87  void __init plat_time_init(void)
88 --- a/drivers/net/ethernet/broadcom/b44.c
89 +++ b/drivers/net/ethernet/broadcom/b44.c
90 @@ -31,6 +31,7 @@
91  #include <linux/ssb/ssb.h>
92  #include <linux/slab.h>
93  #include <linux/phy.h>
94 +#include <linux/bcm47xx_nvram.h>
95  
96  #include <asm/uaccess.h>
97  #include <asm/io.h>
98 @@ -399,8 +400,6 @@ static void b44_set_flow_ctrl(struct b44
99         __b44_set_flow_ctrl(bp, pause_enab);
100  }
101  
102 -#ifdef CONFIG_BCM47XX
103 -#include <bcm47xx_nvram.h>
104  static void b44_wap54g10_workaround(struct b44 *bp)
105  {
106         char buf[20];
107 @@ -429,11 +428,6 @@ static void b44_wap54g10_workaround(stru
108  error:
109         pr_warn("PHY: cannot reset MII transceiver isolate bit\n");
110  }
111 -#else
112 -static inline void b44_wap54g10_workaround(struct b44 *bp)
113 -{
114 -}
115 -#endif
116  
117  static int b44_setup_phy(struct b44 *bp)
118  {
119 --- a/drivers/net/ethernet/broadcom/bgmac.c
120 +++ b/drivers/net/ethernet/broadcom/bgmac.c
121 @@ -17,7 +17,7 @@
122  #include <linux/interrupt.h>
123  #include <linux/dma-mapping.h>
124  #include <linux/platform_data/b53.h>
125 -#include <bcm47xx_nvram.h>
126 +#include <linux/bcm47xx_nvram.h>
127  
128  static const struct bcma_device_id bgmac_bcma_tbl[] = {
129         BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
130 --- a/drivers/ssb/driver_chipcommon_pmu.c
131 +++ b/drivers/ssb/driver_chipcommon_pmu.c
132 @@ -13,9 +13,7 @@
133  #include <linux/ssb/ssb_driver_chipcommon.h>
134  #include <linux/delay.h>
135  #include <linux/export.h>
136 -#ifdef CONFIG_BCM47XX
137 -#include <bcm47xx_nvram.h>
138 -#endif
139 +#include <linux/bcm47xx_nvram.h>
140  
141  #include "ssb_private.h"
142  
143 @@ -320,11 +318,9 @@ static void ssb_pmu_pll_init(struct ssb_
144         u32 crystalfreq = 0; /* in kHz. 0 = keep default freq. */
145  
146         if (bus->bustype == SSB_BUSTYPE_SSB) {
147 -#ifdef CONFIG_BCM47XX
148                 char buf[20];
149                 if (bcm47xx_nvram_getenv("xtalfreq", buf, sizeof(buf)) >= 0)
150                         crystalfreq = simple_strtoul(buf, NULL, 0);
151 -#endif
152         }
153  
154         switch (bus->chip_id) {