brcm63xx: Add profile and build image for Sagemcom F@ST2704V2 ADSL router
[openwrt/openwrt.git] / target / linux / brcm63xx / patches-3.10 / 037-MIPS-BCM63XX-recognize-Cable-Modem-firmware-format.patch
1 From f3b3faafe7b5a1c07b12d18e96c36bc8a0eecaed Mon Sep 17 00:00:00 2001
2 From: Florian Fainelli <florian@openwrt.org>
3 Date: Tue, 18 Jun 2013 16:55:41 +0000
4 Subject: [PATCH 3/6] MIPS: BCM63XX: recognize Cable Modem firmware format
5
6 Add the firmware header format which is used by Broadcom Cable Modem
7 SoCs such as the BCM3368 SoC. We export the bcm_hcs firmware format
8 structure because it is used by user-land tools to create firmware
9 images for these SoCs and will later be used by a corresponding MTD
10 parser.
11
12 Signed-off-by: Florian Fainelli <florian@openwrt.org>
13 Cc: linux-mips@linux-mips.org
14 Cc: cernekee@gmail.com
15 Cc: jogo@openwrt.org
16 Patchwork: https://patchwork.linux-mips.org/patch/5496/
17 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
18 ---
19 arch/mips/bcm63xx/boards/board_bcm963xx.c | 14 ++++++++++++--
20 include/uapi/linux/Kbuild | 1 +
21 include/uapi/linux/bcm933xx_hcs.h | 24 ++++++++++++++++++++++++
22 3 files changed, 37 insertions(+), 2 deletions(-)
23 create mode 100644 include/uapi/linux/bcm933xx_hcs.h
24
25 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
26 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
27 @@ -28,8 +28,12 @@
28 #include <bcm63xx_dev_usb_usbd.h>
29 #include <board_bcm963xx.h>
30
31 +#include <uapi/linux/bcm933xx_hcs.h>
32 +
33 #define PFX "board_bcm963xx: "
34
35 +#define HCS_OFFSET_128K 0x20000
36 +
37 static struct board_info board;
38
39 /*
40 @@ -722,8 +726,9 @@ void __init board_prom_init(void)
41 unsigned int i;
42 u8 *boot_addr, *cfe;
43 char cfe_version[32];
44 - char *board_name;
45 + char *board_name = NULL;
46 u32 val;
47 + struct bcm_hcs *hcs;
48
49 /* read base address of boot chip select (0)
50 * 6328/6362 do not have MPI but boot from a fixed address
51 @@ -747,7 +752,12 @@ void __init board_prom_init(void)
52
53 bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
54
55 - board_name = bcm63xx_nvram_get_name();
56 + if (BCMCPU_IS_3368()) {
57 + hcs = (struct bcm_hcs *)boot_addr;
58 + board_name = hcs->filename;
59 + } else {
60 + board_name = bcm63xx_nvram_get_name();
61 + }
62 /* find board by name */
63 for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
64 if (strncmp(board_name, bcm963xx_boards[i]->name, 16))
65 --- a/include/uapi/linux/Kbuild
66 +++ b/include/uapi/linux/Kbuild
67 @@ -62,6 +62,7 @@ header-y += auxvec.h
68 header-y += ax25.h
69 header-y += b1lli.h
70 header-y += baycom.h
71 +header-y += bcm933xx_hcs.h
72 header-y += bfs_fs.h
73 header-y += binfmts.h
74 header-y += blkpg.h
75 --- /dev/null
76 +++ b/include/uapi/linux/bcm933xx_hcs.h
77 @@ -0,0 +1,24 @@
78 +/*
79 + * Broadcom Cable Modem firmware format
80 + */
81 +
82 +#ifndef __BCM933XX_HCS_H
83 +#define __BCM933XX_HCS_H
84 +
85 +#include <linux/types.h>
86 +
87 +struct bcm_hcs {
88 + __u16 magic;
89 + __u16 control;
90 + __u16 rev_maj;
91 + __u16 rev_min;
92 + __u32 build_date;
93 + __u32 filelen;
94 + __u32 ldaddress;
95 + char filename[64];
96 + __u16 hcs;
97 + __u16 her_znaet_chto;
98 + __u32 crc;
99 +};
100 +
101 +#endif /* __BCM933XX_HCS */