12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/slab.h>
20 #define BCM47XXPART_MAX_PARTS 12
26 #define BCM47XXPART_BYTES_TO_READ 0x404
29 #define BOARD_DATA_MAGIC 0x5246504D
30 #define POT_MAGIC1 0x54544f50
31 #define POT_MAGIC2 0x504f
32 #define ML_MAGIC1 0x39685a42
33 #define ML_MAGIC2 0x26594131
34 #define TRX_MAGIC 0x30524448
53 static int bcm47xxpart_parse(
struct mtd_info *master,
71 for (offset = 0; offset <= master->
size - blocksize;
72 offset += blocksize) {
74 if (offset >= 0x2000000)
78 pr_warn(
"Reached maximum number of partitions, scanning stopped!\n");
84 &bytes_read, (
uint8_t *)buf) < 0) {
85 pr_err(
"mtd_read error while parsing (offset: 0x%X)!\n",
92 bcm47xxpart_add_part(&parts[curr_part++],
"boot",
99 bcm47xxpart_add_part(&parts[curr_part++],
"nvram",
109 bcm47xxpart_add_part(&parts[curr_part++],
"board_data",
117 bcm47xxpart_add_part(&parts[curr_part++],
"POT", offset,
125 bcm47xxpart_add_part(&parts[curr_part++],
"ML", offset,
137 bcm47xxpart_add_part(&parts[curr_part++],
144 bcm47xxpart_add_part(&parts[curr_part++],
"linux",
145 offset + trx->
offset[i], 0);
153 bcm47xxpart_add_part(&parts[curr_part++],
"rootfs",
154 offset + trx->
offset[i], 0);
172 for (i = 0; i < curr_part - 1; i++)
173 parts[i].
size = parts[i + 1].offset - parts[i].offset;
175 parts[curr_part - 1].
size =
184 .parse_fn = bcm47xxpart_parse,
185 .name =
"bcm47xxpart",
188 static int __init bcm47xxpart_init(
void)
193 static void __exit bcm47xxpart_exit(
void)