TP-Link C2600 - missing "default-mac" MTD partition in snapshot

For some time now ethernet ports are unusable on C2600 when using snapshots as reported here FS#3945. I've narrowed it down to missing default-mac mtd partition - at least it seems to be the problem as no error is being reported by the driver. I'm not able to figure out why is not present when doing cat /proc/mtd as dts seems to have it defined.

WiFi does work, but both bands have some seemingly random MAC addresses.

Can someone take a quick look and point me in the right direction?


It seems that the missing partition is intended behavior ( but kernel on C2600 doesn't fetch the MAC address and this breaks eth0/1.

Any pointers on how to debug this as I don't really know where to look next?


Wait this is still not fixed?

Nope, it's still broken in last snapshot. Anything I can check to narrow it down?

I need to check the dts

I've set up a build system and added a few pr_info statements to find the cause of the error and it seems that it breaks here:

I went down the rabbit hole and eventually found that the reason for the failure originates here:

It's like partition is not registered as mtd device anymore but it has not been added to nvmem devices at the same time - or I'm reading it wrong?

Hey @Ansuel

I've found the reason for the missing partition and made a simple workaround.

The trouble starts with the problematic partition having compatible = "nvmem-cells"; defined in dts. When enumerating partitions mtd eventually calls parse_fixed_partitions function which calls node_has_compatible function defined in /drivers/mtd/parsers/ofpart_core.c like this:

static bool node_has_compatible(struct device_node *pp)
	return of_get_property(pp, "compatible", NULL);

The addition of compatible = "nvmem-cells"; makes node_has_compatible to return true and for that reason parse_fixed_partitions skips that partition and mtd in return doesn't call nvmem_register and the whole thing breaks as described earlier.

I've rewritten the node_has_compatible function like so:

static bool node_has_compatible(struct device_node *pp)
        return of_device_is_compatible(pp, "nvmem-cells") ? false : of_get_property(pp, "compatible", NULL);

The code simply ignores compatible = "nvmem-cells"; and this fixes the LAN on my C2600.

I'm not sure if there should be a more appropriate way to get the partition to register into nvmem subsystem?

In theory you should be able todeclare compatible fixed-partitions for this specific case

But anyway it seems the problem is compatible and nvmem

Thx for bisecting this

I've enclosed all partition definitions of flash@0 into partitions property with compatible = "fixed-partitions" and it actually works!
I'll make a PR on github later today when I clean up everything and retest once more to be sure.

Thanks for the idea!

Will try to make a pr, can you check if it will fix the problem?

This works for me:

I can make PR and we can discuss it there?

1 Like

ohhh ok i see the problem... that is not supported... the problem is really not following standard partition definition...

Create a pr and also put in the description that the current partition definition is not standard and nvmem require the standard partitions scheme to work correctly.

Also feel free to add my reviewed by tag

Thanks - here's the PR, we can continue discussion there:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.