brcm63xx: backport bcm963xx_tag.h upstream changes
[openwrt/staging/noltari.git] / target / linux / generic / patches-4.4 / 044-0002-MIPS-bcm963xx-Move-extended-flash-address-to-bcm_tag.patch
1 From 1f29cb19cb7c3bea870d7da02ec23823af9d636e Mon Sep 17 00:00:00 2001
2 From: Simon Arlott <simon@fire.lp0.eu>
3 Date: Sun, 13 Dec 2015 22:47:55 +0000
4 Subject: [PATCH] MIPS: bcm963xx: Move extended flash address to bcm_tag header
5 file
6
7 The extended flash address needs to be subtracted from bcm_tag flash
8 image offsets. Move this value to the bcm_tag header file.
9
10 Renamed define name to consistently use bcm963xx for flash layout
11 which should be considered a property of the board and not the SoC
12 (i.e. bcm63xx could theoretically be used on a board without CFE
13 or any flash).
14
15 Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
16 Cc: David Woodhouse <dwmw2@infradead.org>
17 Cc: Brian Norris <computersforpeace@gmail.com>
18 Cc: Kevin Cernekee <cernekee@gmail.com>
19 Cc: Florian Fainelli <f.fainelli@gmail.com>
20 Cc: Jonas Gorski <jogo@openwrt.org>
21 Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
22 Cc: MIPS Mailing List <linux-mips@linux-mips.org>
23 Cc: MTD Maling List <linux-mtd@lists.infradead.org>
24 Patchwork: https://patchwork.linux-mips.org/patch/11833/
25 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
26 ---
27 drivers/mtd/bcm63xxpart.c | 6 ++----
28 include/linux/bcm963xx_tag.h | 5 +++++
29 2 files changed, 7 insertions(+), 4 deletions(-)
30
31 --- a/drivers/mtd/bcm63xxpart.c
32 +++ b/drivers/mtd/bcm63xxpart.c
33 @@ -37,8 +37,6 @@
34 #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
35 #include <asm/mach-bcm63xx/board_bcm963xx.h>
36
37 -#define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
38 -
39 #define BCM63XX_CFE_BLOCK_SIZE SZ_64K /* always at least 64KiB */
40
41 #define BCM63XX_CFE_MAGIC_OFFSET 0x4e0
42 @@ -123,8 +121,8 @@ static int bcm63xx_parse_cfe_partitions(
43 pr_info("CFE boot tag found with version %s and board type %s\n",
44 tagversion, boardid);
45
46 - kerneladdr = kerneladdr - BCM63XX_EXTENDED_SIZE;
47 - rootfsaddr = rootfsaddr - BCM63XX_EXTENDED_SIZE;
48 + kerneladdr = kerneladdr - BCM963XX_EXTENDED_SIZE;
49 + rootfsaddr = rootfsaddr - BCM963XX_EXTENDED_SIZE;
50 spareaddr = roundup(totallen, master->erasesize) + cfelen;
51
52 if (rootfsaddr < kerneladdr) {
53 --- a/include/linux/bcm963xx_tag.h
54 +++ b/include/linux/bcm963xx_tag.h
55 @@ -28,6 +28,11 @@
56 "DWV-S0", \
57 }
58
59 +/* Extended flash address, needs to be subtracted
60 + * from bcm_tag flash image offsets.
61 + */
62 +#define BCM963XX_EXTENDED_SIZE 0xBFC00000
63 +
64 /*
65 * The broadcom firmware assumes the rootfs starts the image,
66 * therefore uses the rootfs start (flash_image_address)