First try to support CPE210 v2 - will not boot

good catch. qca9533 has only pins 0-17.

That PR is for v1 but I think that is faulty even for v1 since GPIO 21 and 22 are not defined and many people have been over the board.
What is CONFIG_QCA_GPIO_MASK_OUT_INIT_H and CONFIG_QCA_GPIO_MASK_OUT used for?
Is it maybe UART?

GPIO 21 & 22 are defined in WDR3600 profile that also use AR934X as CPE210v1 so the PR might be good.

just remove these two and leave LED_ACT_L for MASK_OUT/MASK_OUT_INIT_H.

it is not UART. i think it defines GPIO direction/value

Ok.
Any tips on CFG_LOAD_ADDR ,CFG_ENV_ADDR,CFG_ENV_SIZE and CFG_ENV_SECT_SIZE

you can adapt them for 128K uboot or use default ones with CONFIG_FOR_TPLINK_WR842N_V3 bootargs profile.

more accurate bootargs you can find in first post #Output of /proc/cmdline:

Hm,shouldnt it already be 128k?

size depends on chosen bootargs

@psyborg Well, I just copied current bootargs from printenv.
It looks like they split u-boot to two 32k partitions while 128k is reserved for u-boot.
To me, that has no logic.
How does one calculate those addresses?

Sorry for asking so many questions but I am not really expert in the bootloader field

try adding to ap143.h line 245:

#elif defined(CONFIG_FOR_TPLINK_CPE210_V2)

	#define CONFIG_BOOTARGS	"console=ttyS0,115200 root=31:02 "\
				"rootfstype=squashfs init=/sbin/init "\
				"mtdparts=ath-nor0:128k(u-boot),64k(pation-table),64k(product-info),1536k(kernel),6144k(rootfs),192k(config),64k(art)"

line 300:

#elif defined(CONFIG_FOR_TPLINK_CPE210_V2)
	#define CFG_LOAD_ADDR	0x9F040000

do you have flash dump of original firmware?

Yes, @MartinS posted one

Changes made:

add

defined(CONFIG_FOR_TPLINK_CPE210_V2) ||\

at /* Firmware size limit */ ->>>> calculate based on partitons size

and after:

defined(CONFIG_FOR_TPLINK_WR902AC_V1)

in PLL/Clocks configuration

@psyborg From what I get that size is size of partitions that are not to be touched like ART and u-boot?
It looks like it is,so that would be 512k.
Also I added MAC but I doubt it is that due to different partition structure that other TP Link devices.
But that can be fixed later.

Now only thing remaining is Environment configuration
How do you determine CFG_ENV_ADDR?
Currently I read it from: https://gist.github.com/robimarko/42e5a4df26708afe5f31f0e70b8ce902#file-gistfile1-txt-L13
CFG_ENV_SIZE I read from current u-boot as well to be precise I read environment size and converted that into HEX
https://github.com/robimarko/u-boot_mod/blob/CPE-210v2/u-boot/include/configs/ap143.h#L364

I contacted pepe2k and he explained that safeloader devices are not supported so web firmware update size and env adress are not needed since device does not have writable environment at all.
He also mentioned that he saw similar issue when tp-link used same GPIO pins for UART for something else also.
Also he mentioned that it could be that stock u-boot does set LS UART and GPIO Mux correctly.

try if you can recover with pi combo, build u-boot and flash

@psyborg Yes,I am now installing raspbian to see if I can take a flash dump.
If it works I will build u-boot and flash it.
I gotta check how to only flash part of flash with flashrom.

Looks like I am gonna have to unsolder the flash since this pomona clip is utterly useless.

Finally managed to build.


And ENV variables cant be empty

Did you succeed in flashing? I tried it myself with your modifications to u-boot_mod, build and flashed fine, but the output on the serial is messed up. Looks like a wrong baud rate, at least none my usb serial adapter could handle. After that the web interface worked just fine.

I did not have time to try.
Maybe tomorrow.

It is weird that it is messed up.
I selected 115200 for default bootargs.

Can you use network console and choose another baud rate, also can you check that MAC is detected correctly?

Its actually ~71400. I figured out why.
This function in uboot/cpu/mips/ar7240/qca_common.c returns the wrong value (it return 1, but theres a 25 MHz on the board). I got it to work just fine by just returning 0 there. No idea how to fix this properly.

Loading an image (oem or lede) through the webinterface seams to work but i could not get anything to boot.