[OpenWrt-Devel] [PATCH] [brcm47xx] Belkin F7DXXXX (BCM47XX based) support for Linux 3.18

Rafał Miłecki zajec5 at gmail.com
Tue Jun 23 03:46:28 EDT 2015


As Hauke noted, whole patch is white space damaged. Please re-send properly.


> @@ -184,7 +204,7 @@ mtd_fixtrx(const char *mtd, size_t offset)
>   }
>
>   trx = (struct trx_header *) (buf + offset);
> - if (trx->magic != STORE32_LE(0x30524448)) {
> + if (!is_trx_magic(trx->magic)) {

Is dropping STORE32_LE safe? Should this be sth like
le32_to_cpu(trx->magic)
?


> +static int is_trx_magic(uint32_t magic) {
> +        magic = cpu_to_le32(magic);

Are you sure about this? First you call le32_to_cp and then
cpu_to_l32. I think you also just broke TRX_MAGIC support.
Previously we got:
if (le32_to_cpu(hdr.magic) != TRX_MAGIC)



> @@ -186,7 +212,7 @@ static int otrx_check(int argc, char **argv) {
>    goto err_close;
>   }
>
> - if (le32_to_cpu(hdr.magic) != TRX_MAGIC) {
> + if (!is_trx_magic(le32_to_cpu(hdr.magic))) {

There is a call related to above comment.


> diff --git a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
> b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
> index cbadefb..9f12715 100644
> --- a/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/brcm47xx/base-files/lib/upgrade/platform.sh
> @@ -51,6 +51,10 @@ platform_expected_image() {
>    "Linksys WRT310N V2") echo "cybertan 310N"; return;;
>    "Linksys WRT610N V1") echo "cybertan 610N"; return;;
>    "Linksys WRT610N V2") echo "cybertan 610N"; return;;
> +  "Belkin F7D3301") echo "22031020"; return;;
> +  "Belkin F7D3302") echo "28090920"; return;;
> +  "Belkin F7D4302") echo "06101020"; return;;
> +  "Belkin F7D4401")       echo "17850100"; return;;

I just think if we should follow "type id" logic like "beltrx
22031020". I did that for other formats to make sure there won't be
collisions like two different formats using the same magic. In case of
Belkin it's a bit tricky because their every ID could be treated as
separated format.


> @@ -124,6 +144,25 @@ platform_check_image() {
>      error=1
>     fi
>    ;;
> +  "beltrx")
> +   local dev_board_id=$(platform_expected_image)
> +   local machine=$(platform_machine)
> +   local magic=$(get_magic_long "$1")
> +   echo "Found TRX image with Belkin Magic TRX"
> +   echo "Anticipating a $machine, checking..."


You don't really need this $machine. And if you think we should print
it for whatever reason, propose it as global change for all formats.
I'm not sure if that's needed however.


> diff --git
> a/target/linux/brcm47xx/patches-3.18/032-11-MIPS-BCM47XX-Include-Belkin-F7D4XXX-F7D3XXX-TRX-for-mtd.patch
> b/target/linux/brcm47xx/patches-3.18/032-11-MIPS-BCM47XX-Include-Belkin-F7D4XXX-F7D3XXX-TRX-for-mtd.patch
> new file mode 100644
> index 0000000..8e2c1df
> --- /dev/null
> +++
> b/target/linux/brcm47xx/patches-3.18/032-11-MIPS-BCM47XX-Include-Belkin-F7D4XXX-F7D3XXX-TRX-for-mtd.patch
> @@ -0,0 +1,43 @@
> +--- a/drivers/mtd/bcm47xxpart.c
> ++++ b/drivers/mtd/bcm47xxpart.c
> +@@ -45,6 +45,10 @@
> + #define TRX_MAGIC   0x30524448
> + #define SHSQ_MAGIC   0x71736873 /* shsq (weird ZTE H218N endianness) */
> + #define UBI_EC_MAGIC   0x23494255 /* UBI# */
> ++#define BELKIN_F7D3301_MAGIC  0x20100322 /* Belkin TRX */
> ++#define BELKIN_F7D3302_MAGIC  0x20090928
> ++#define BELKIN_F7D4302_MAGIC  0x20101006
> ++#define BELKIN_F7D4401_MAGIC  0x00018517

Please send this patch for mainline inclusion, base it on top of:
http://git.infradead.org/l2-mtd.git
I don't want to have more brcm47xx patches noone will ever upstream ;)


Good work in general!

-- 
Rafał
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list