dd2fbae01f322f81d72d92afda5975ab9d950ba8
[openwrt/openwrt.git] / target / linux / generic / patches-3.6 / 260-move_bcm963xx_tag.patch
1 --- a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
2 +++ /dev/null
3 @@ -1,96 +0,0 @@
4 -#ifndef __BCM963XX_TAG_H
5 -#define __BCM963XX_TAG_H
6 -
7 -#define TAGVER_LEN 4 /* Length of Tag Version */
8 -#define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */
9 -#define SIG1_LEN 20 /* Company Signature 1 Length */
10 -#define SIG2_LEN 14 /* Company Signature 2 Length */
11 -#define BOARDID_LEN 16 /* Length of BoardId */
12 -#define ENDIANFLAG_LEN 2 /* Endian Flag Length */
13 -#define CHIPID_LEN 6 /* Chip Id Length */
14 -#define IMAGE_LEN 10 /* Length of Length Field */
15 -#define ADDRESS_LEN 12 /* Length of Address field */
16 -#define DUALFLAG_LEN 2 /* Dual Image flag Length */
17 -#define INACTIVEFLAG_LEN 2 /* Inactie Flag Length */
18 -#define RSASIG_LEN 20 /* Length of RSA Signature in tag */
19 -#define TAGINFO1_LEN 30 /* Length of vendor information field1 in tag */
20 -#define FLASHLAYOUTVER_LEN 4 /* Length of Flash Layout Version String tag */
21 -#define TAGINFO2_LEN 16 /* Length of vendor information field2 in tag */
22 -#define ALTTAGINFO_LEN 54 /* Alternate length for vendor information; Pirelli */
23 -
24 -#define NUM_PIRELLI 2
25 -#define IMAGETAG_CRC_START 0xFFFFFFFF
26 -
27 -#define PIRELLI_BOARDS { \
28 - "AGPF-S0", \
29 - "DWV-S0", \
30 -}
31 -
32 -/*
33 - * The broadcom firmware assumes the rootfs starts the image,
34 - * therefore uses the rootfs start (flash_image_address)
35 - * to determine where to flash the image. Since we have the kernel first
36 - * we have to give it the kernel address, but the crc uses the length
37 - * associated with this address (root_length), which is added to the kernel
38 - * length (kernel_length) to determine the length of image to flash and thus
39 - * needs to be rootfs + deadcode (jffs2 EOF marker)
40 -*/
41 -
42 -struct bcm_tag {
43 - /* 0-3: Version of the image tag */
44 - char tag_version[TAGVER_LEN];
45 - /* 4-23: Company Line 1 */
46 - char sig_1[SIG1_LEN];
47 - /* 24-37: Company Line 2 */
48 - char sig_2[SIG2_LEN];
49 - /* 38-43: Chip this image is for */
50 - char chip_id[CHIPID_LEN];
51 - /* 44-59: Board name */
52 - char board_id[BOARDID_LEN];
53 - /* 60-61: Map endianness -- 1 BE 0 LE */
54 - char big_endian[ENDIANFLAG_LEN];
55 - /* 62-71: Total length of image */
56 - char total_length[IMAGE_LEN];
57 - /* 72-83: Address in memory of CFE */
58 - char cfe__address[ADDRESS_LEN];
59 - /* 84-93: Size of CFE */
60 - char cfe_length[IMAGE_LEN];
61 - /* 94-105: Address in memory of image start
62 - * (kernel for OpenWRT, rootfs for stock firmware)
63 - */
64 - char flash_image_start[ADDRESS_LEN];
65 - /* 106-115: Size of rootfs */
66 - char root_length[IMAGE_LEN];
67 - /* 116-127: Address in memory of kernel */
68 - char kernel_address[ADDRESS_LEN];
69 - /* 128-137: Size of kernel */
70 - char kernel_length[IMAGE_LEN];
71 - /* 138-139: Unused at the moment */
72 - char dual_image[DUALFLAG_LEN];
73 - /* 140-141: Unused at the moment */
74 - char inactive_flag[INACTIVEFLAG_LEN];
75 - /* 142-161: RSA Signature (not used; some vendors may use this) */
76 - char rsa_signature[RSASIG_LEN];
77 - /* 162-191: Compilation and related information (not used in OpenWrt) */
78 - char information1[TAGINFO1_LEN];
79 - /* 192-195: Version flash layout */
80 - char flash_layout_ver[FLASHLAYOUTVER_LEN];
81 - /* 196-199: kernel+rootfs CRC32 */
82 - __u32 fskernel_crc;
83 - /* 200-215: Unused except on Alice Gate where is is information */
84 - char information2[TAGINFO2_LEN];
85 - /* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
86 - __u32 image_crc;
87 - /* 220-223: CRC32 of rootfs partition */
88 - __u32 rootfs_crc;
89 - /* 224-227: CRC32 of kernel partition */
90 - __u32 kernel_crc;
91 - /* 228-235: Unused at present */
92 - char reserved1[8];
93 - /* 236-239: CRC32 of header excluding last 20 bytes */
94 - __u32 header_crc;
95 - /* 240-255: Unused at present */
96 - char reserved2[16];
97 -};
98 -
99 -#endif /* __BCM63XX_TAG_H */
100 --- a/drivers/mtd/bcm63xxpart.c
101 +++ b/drivers/mtd/bcm63xxpart.c
102 @@ -32,7 +32,7 @@
103 #include <linux/mtd/mtd.h>
104 #include <linux/mtd/partitions.h>
105
106 -#include <asm/mach-bcm63xx/bcm963xx_tag.h>
107 +#include <linux/bcm963xx_tag.h>
108 #include <asm/mach-bcm63xx/board_bcm963xx.h>
109
110 #define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
111 --- a/include/linux/Kbuild
112 +++ b/include/linux/Kbuild
113 @@ -78,6 +78,7 @@ header-y += blk_types.h
114 header-y += blkpg.h
115 header-y += blktrace_api.h
116 header-y += bpqether.h
117 +header-y += bcm963xx_tag.h
118 header-y += bsg.h
119 header-y += can.h
120 header-y += capability.h
121 --- /dev/null
122 +++ b/include/linux/bcm963xx_tag.h
123 @@ -0,0 +1,96 @@
124 +#ifndef __BCM963XX_TAG_H
125 +#define __BCM963XX_TAG_H
126 +
127 +#define TAGVER_LEN 4 /* Length of Tag Version */
128 +#define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */
129 +#define SIG1_LEN 20 /* Company Signature 1 Length */
130 +#define SIG2_LEN 14 /* Company Signature 2 Length */
131 +#define BOARDID_LEN 16 /* Length of BoardId */
132 +#define ENDIANFLAG_LEN 2 /* Endian Flag Length */
133 +#define CHIPID_LEN 6 /* Chip Id Length */
134 +#define IMAGE_LEN 10 /* Length of Length Field */
135 +#define ADDRESS_LEN 12 /* Length of Address field */
136 +#define DUALFLAG_LEN 2 /* Dual Image flag Length */
137 +#define INACTIVEFLAG_LEN 2 /* Inactie Flag Length */
138 +#define RSASIG_LEN 20 /* Length of RSA Signature in tag */
139 +#define TAGINFO1_LEN 30 /* Length of vendor information field1 in tag */
140 +#define FLASHLAYOUTVER_LEN 4 /* Length of Flash Layout Version String tag */
141 +#define TAGINFO2_LEN 16 /* Length of vendor information field2 in tag */
142 +#define ALTTAGINFO_LEN 54 /* Alternate length for vendor information; Pirelli */
143 +
144 +#define NUM_PIRELLI 2
145 +#define IMAGETAG_CRC_START 0xFFFFFFFF
146 +
147 +#define PIRELLI_BOARDS { \
148 + "AGPF-S0", \
149 + "DWV-S0", \
150 +}
151 +
152 +/*
153 + * The broadcom firmware assumes the rootfs starts the image,
154 + * therefore uses the rootfs start (flash_image_address)
155 + * to determine where to flash the image. Since we have the kernel first
156 + * we have to give it the kernel address, but the crc uses the length
157 + * associated with this address (root_length), which is added to the kernel
158 + * length (kernel_length) to determine the length of image to flash and thus
159 + * needs to be rootfs + deadcode (jffs2 EOF marker)
160 +*/
161 +
162 +struct bcm_tag {
163 + /* 0-3: Version of the image tag */
164 + char tag_version[TAGVER_LEN];
165 + /* 4-23: Company Line 1 */
166 + char sig_1[SIG1_LEN];
167 + /* 24-37: Company Line 2 */
168 + char sig_2[SIG2_LEN];
169 + /* 38-43: Chip this image is for */
170 + char chip_id[CHIPID_LEN];
171 + /* 44-59: Board name */
172 + char board_id[BOARDID_LEN];
173 + /* 60-61: Map endianness -- 1 BE 0 LE */
174 + char big_endian[ENDIANFLAG_LEN];
175 + /* 62-71: Total length of image */
176 + char total_length[IMAGE_LEN];
177 + /* 72-83: Address in memory of CFE */
178 + char cfe__address[ADDRESS_LEN];
179 + /* 84-93: Size of CFE */
180 + char cfe_length[IMAGE_LEN];
181 + /* 94-105: Address in memory of image start
182 + * (kernel for OpenWRT, rootfs for stock firmware)
183 + */
184 + char flash_image_start[ADDRESS_LEN];
185 + /* 106-115: Size of rootfs */
186 + char root_length[IMAGE_LEN];
187 + /* 116-127: Address in memory of kernel */
188 + char kernel_address[ADDRESS_LEN];
189 + /* 128-137: Size of kernel */
190 + char kernel_length[IMAGE_LEN];
191 + /* 138-139: Unused at the moment */
192 + char dual_image[DUALFLAG_LEN];
193 + /* 140-141: Unused at the moment */
194 + char inactive_flag[INACTIVEFLAG_LEN];
195 + /* 142-161: RSA Signature (not used; some vendors may use this) */
196 + char rsa_signature[RSASIG_LEN];
197 + /* 162-191: Compilation and related information (not used in OpenWrt) */
198 + char information1[TAGINFO1_LEN];
199 + /* 192-195: Version flash layout */
200 + char flash_layout_ver[FLASHLAYOUTVER_LEN];
201 + /* 196-199: kernel+rootfs CRC32 */
202 + __u32 fskernel_crc;
203 + /* 200-215: Unused except on Alice Gate where is is information */
204 + char information2[TAGINFO2_LEN];
205 + /* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
206 + __u32 image_crc;
207 + /* 220-223: CRC32 of rootfs partition */
208 + __u32 rootfs_crc;
209 + /* 224-227: CRC32 of kernel partition */
210 + __u32 kernel_crc;
211 + /* 228-235: Unused at present */
212 + char reserved1[8];
213 + /* 236-239: CRC32 of header excluding last 20 bytes */
214 + __u32 header_crc;
215 + /* 240-255: Unused at present */
216 + char reserved2[16];
217 +};
218 +
219 +#endif /* __BCM63XX_TAG_H */