Skip to content

Commit d753601

Browse files
ffainelliralfbaechle
authored andcommitted
MIPS: BCM63XX: recognize Cable Modem firmware format
Add the firmware header format which is used by Broadcom Cable Modem SoCs such as the BCM3368 SoC. We export the bcm_hcs firmware format structure because it is used by user-land tools to create firmware images for these SoCs and will later be used by a corresponding MTD parser. Signed-off-by: Florian Fainelli <florian@openwrt.org> Cc: linux-mips@linux-mips.org Cc: cernekee@gmail.com Cc: jogo@openwrt.org Patchwork: https://patchwork.linux-mips.org/patch/5496/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 7b93342 commit d753601

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

‎arch/mips/bcm63xx/boards/board_bcm963xx.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@
2828
#include <bcm63xx_dev_usb_usbd.h>
2929
#include <board_bcm963xx.h>
3030

31+
#include <uapi/linux/bcm933xx_hcs.h>
32+
3133
#define PFX "board_bcm963xx: "
3234

35+
#define HCS_OFFSET_128K 0x20000
36+
3337
static struct board_info board;
3438

3539
/*
@@ -722,8 +726,9 @@ void __init board_prom_init(void)
722726
unsigned int i;
723727
u8 *boot_addr, *cfe;
724728
char cfe_version[32];
725-
char *board_name;
729+
char *board_name = NULL;
726730
u32 val;
731+
struct bcm_hcs *hcs;
727732

728733
/* read base address of boot chip select (0)
729734
* 6328/6362 do not have MPI but boot from a fixed address
@@ -747,7 +752,12 @@ void __init board_prom_init(void)
747752

748753
bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
749754

750-
board_name = bcm63xx_nvram_get_name();
755+
if (BCMCPU_IS_3368()) {
756+
hcs = (struct bcm_hcs *)boot_addr;
757+
board_name = hcs->filename;
758+
} else {
759+
board_name = bcm63xx_nvram_get_name();
760+
}
751761
/* find board by name */
752762
for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
753763
if (strncmp(board_name, bcm963xx_boards[i]->name, 16))

‎include/uapi/linux/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ header-y += auxvec.h
6262
header-y += ax25.h
6363
header-y += b1lli.h
6464
header-y += baycom.h
65+
header-y += bcm933xx_hcs.h
6566
header-y += bfs_fs.h
6667
header-y += binfmts.h
6768
header-y += blkpg.h

‎include/uapi/linux/bcm933xx_hcs.h‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Broadcom Cable Modem firmware format
3+
*/
4+
5+
#ifndef __BCM933XX_HCS_H
6+
#define __BCM933XX_HCS_H
7+
8+
#include <linux/types.h>
9+
10+
struct bcm_hcs {
11+
__u16 magic;
12+
__u16 control;
13+
__u16 rev_maj;
14+
__u16 rev_min;
15+
__u32 build_date;
16+
__u32 filelen;
17+
__u32 ldaddress;
18+
char filename[64];
19+
__u16 hcs;
20+
__u16 her_znaet_chto;
21+
__u32 crc;
22+
};
23+
24+
#endif /* __BCM933XX_HCS */

0 commit comments

Comments
 (0)