Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ar71xx: add support for TP-Link CPE210 v2 #937

Closed
wants to merge 2 commits into from

Conversation

adschm
Copy link
Member

@adschm adschm commented May 11, 2018

Since PR #642 has been open for a long time, this is an attempt to finalize the support of the CPE210 v2.

I hope the original author will forgive my impatience.

Changes compared to the last state of PR #642:

  • Fixed partitions in tplink-safeloader.c
  • Reduced duplicate code in target/linux/ar71xx/base-files/lib/ar71xx.sh
  • Reduced duplicate code in target/linux/ar71xx/base-files/lib/upgrade/platform.sh

If my "duplicate" PR is against protocol, please tell me and/or close it.

@robimarko
Copy link
Contributor

@adrianschmutzler No issues,I will close mine as I have exams coming up and various projects at work.

Copy link

@genofire genofire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question

return 1
;;
cpe210-v2)
tplink_pharos_v2_check_image "$1" "01000000" "$(tplink_pharos_v2_get_model_string)" '\0\xff\r' && return 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sry my stupped question - where is tplink_pharos_v2_check_image could only find tplink_pharos_check_image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find. I overlooked this when merging tplink_pharos_v2_check_image and tplink_pharos_check_image.
Commit should already be updated!

@achterin
Copy link
Contributor

achterin commented Jun 2, 2018

Is there any reason why this pr didn't get merged already? I can confirm everything works as expected.

@adschm
Copy link
Member Author

adschm commented Jun 16, 2018

I think this commit breaks the PR:

805e59c

Any ideas on how to implement it? Or should we just keep the old loader and stop inheriting from the cpe210v1 config?

@rotanid
Copy link
Contributor

rotanid commented Jun 16, 2018

@adrianschmutzler maybe the author of that commit can answer this best: @NeoRaider

@neocturne
Copy link
Member

Either way is fine. The okli-loader makes the flash layout more flexible (as described in the commit message of 805e59c), but as the flash layout should be fine for some kernel growth with the current 1.75MB os-image, you can also use the old image build commands. If you go with the old commands, you can also try removing patch-cmdline and switching from loader-kernel to loader-kernel-cmdline instead - my lzma-loader fixes might have fixed loader-kernel-cmdline for the ELF loader type (loader-kernel-cmdline was broken in this setup before, so we resorted to using patch-cmdline to get the cmdline into the image.)

I'm a bit surprised that it doesn't just work with okli-loader without further changes, as CPE210 v1 and v2 have the same offset to the os-image partition...

@adschm
Copy link
Member Author

adschm commented Jun 21, 2018

I didn't test it, so it may still work.
I just was stirred up by the additional definitions
153 + LOADER_FLASH_OFFS := 0x43000
154 + COMPILE := loader-$(1).elf
155 + COMPILE/loader-$(1).elf := loader-okli-compile
since they are inherited and I do not know whether they will do "damage" if I do not overwrite/remove them (while keeping the current KERNEL definition in v2!).

Your change won't change the CPE210v2 to okli-leader, since the definition for v2 has its own KERNEL := ... line and thus this part is not affected by the commit 805e59c.

Since I don't feel capable of really implementing/testing the new loader, either someone else would have to help me here or I will stick to old one. For the old one, I would tend to not inherit from Device/cpe510-520-v1 anymore, as this gave me problems more than once.

Opinions?

@neocturne
Copy link
Member

Ah, I overlooked the KERNEL definition. In this case, I'd just recommend not inheriting the v1 definitions anymore. Common settings like mtdparts could be moved into a new define inherited by both cpe510-520-v1 and cpe210-v1.

Add support for detecting TP-Link Pharos v2 boards.
They use different format in product-info partition than v1 boards.

Code was written mostly by Alexander Couzens <lynxis@fe80.eu>

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Signed-off-by: Robert Marko <robimarko@gmail.com>
This PR adds support for a popular low-cost 2.4GHz N based AP

Specifications:
 - SoC: Qualcomm Atheros QCA9533 (650MHz)
 - RAM: 64MB
 - Storage: 8 MB SPI NOR
 - Wireless: 2.4GHz N based built into SoC 2x2
 - Ethernet: 1x 100/10 Mbps, integrated into SoC, 24V POE IN

Installation:
Flash factory image through stock firmware WEB UI
or through TFTP
To get to TFTP recovery just hold reset button while powering on for
around 4-5 seconds and release.
Rename factory image to recovery.bin
Stock TFTP server IP:192.168.0.100
Stock device TFTP adress:192.168.0.254

Notes:
TP-Link does not use bootstrap registers so without this patch reference
clock detects as 40MHz while it is actually 25MHz.
This is due to messed up bootstrap resistor configuration on the PCB.
Provided GPL code just forces 25MHz reference clock.
That causes booting with completely wrong clocks, for example, CPU tries
to boot at 1040MHz while the stock is 650MHz.
So this PR depends on PR openwrt#672 to remove 40MHz reference clock.
Thanks to Sven Eckelmann <sven@narfation.org> for properly patching that.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Signed-off-by: Robert Marko <robimarko@gmail.com>
@adschm
Copy link
Member Author

adschm commented Jun 21, 2018

Fixed as suggested and rebased.
Did not have time to test it on device ...

@neocturne
Copy link
Member

I've verified that CPE510 v1 is working fine with these changes, including sysupgrade. It would be great if you could give your last changes a final test run on the CPE210 v2, then we can get this merged.

@adschm
Copy link
Member Author

adschm commented Jun 23, 2018

Run Test successful. Only tested with sysupgrade...

@neocturne
Copy link
Member

Thanks, merged!

I noticed 2 minor issues when merging, which I fixed up:

  • Multiple Signed-off-by lines are usually added in the order that people worked on the code (as it is also done by git commit -s)
  • I moved the new Device/cpexxx section from the top to the actual cpe device definitions

@neocturne neocturne closed this Jun 23, 2018
@adschm
Copy link
Member Author

adschm commented Jun 24, 2018

@NeoRaider
There are code guidelines which said that the Author and Commit field should be the same person. However, GitHub only considers the first commit name here, so this is why I did it this way.
From a logical point of view, I also would have chosen "your" order.

Thanks for merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target/ar71xx pull request/issue for ar71xx target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants