Skip to content

ramips: Add support for HiWiFi HC5962#865

Closed
gigibox wants to merge 1 commit intolede-project:masterfrom
gigibox:patch-hc5962
Closed

ramips: Add support for HiWiFi HC5962#865
gigibox wants to merge 1 commit intolede-project:masterfrom
gigibox:patch-hc5962

Conversation

@gigibox
Copy link
Contributor

@gigibox gigibox commented Feb 22, 2017

This patch adds supports for the HiWiFi HC5962(gee4) http://www.hiwifi.com

Short specification:

  • MT7621AT + MT7612EN + 7603EN
  • 256MB DDR3 RAM
  • 128MB NAND flash
  • 1+3 x 1000M Ethernet
  • 1x USB 2.0 port. 1x USB 3.0 port
  • UART pad on PCB (JP3: TX, RX, GND, 3.3V)

Flash instruction:

  1. Download lede-ramips-mt7621-hc5962-squashfs-factory.bin
  2. Login as root via SSH on 192.168.199.1 and then copy factory.bin(using wget or nc or...) to /tmp/
  3. use the following commands:
    $ mtd write /tmp/lede-ramips-mt7621-hc5962-squashfs-factory.bin firmware
    $ mtd erase firmware_backup && reboot
    After reboot you should be able to login as root via SSH on 192.168.1.1

Signed-off-by: ZengFei Zhang zhangzengfei@kunteng.org

@liudf0716
Copy link

good job

Copy link
Member

@pepe2k pepe2k left a comment

Choose a reason for hiding this comment

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

Hello @gigibox,

Thank you for your contribution, please find my comments below.

Please, include also some short description about the device you are adding support for and how to flash LEDE image on it, inside the commit message. You can find many different examples in commit history.

Cheers,
Piotr

Copy link
Member

Choose a reason for hiding this comment

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

This will be misleading for the user as this LED is already set for status in diag.sh. Please, drop this line.

Copy link
Member

Choose a reason for hiding this comment

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

Please, keep boards in alphabetical order here.

Copy link
Member

Choose a reason for hiding this comment

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

Please, keep boards in alphabetical order here.

Copy link
Member

Choose a reason for hiding this comment

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

Please, keep boards in alphabetical order here (hc5*61 should be first).

Copy link
Member

Choose a reason for hiding this comment

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

Please, use only status here.

Copy link
Member

Choose a reason for hiding this comment

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

Remove this new line, please.

Copy link
Member

Choose a reason for hiding this comment

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

Please, keep all boards in alphabetical order here.

Copy link
Member

Choose a reason for hiding this comment

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

Drop this line, please.

Copy link
Member

Choose a reason for hiding this comment

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

Drop this line, please.

Copy link
Member

Choose a reason for hiding this comment

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

KiB is a wrong unit here.

Copy link
Contributor

@mkresin mkresin left a comment

Choose a reason for hiding this comment

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

Please use git commit --amend to add changes to your commit. Use git push --force to overwrite your github repository/branch. The PR will afterwards update automatically.

Copy link
Contributor

Choose a reason for hiding this comment

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

Any specific reason why you switch the LED to on here? If not, drop it.


#include "mt7621.dtsi"

#include <dt-bindings/input/input.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please include <dt-bindings/gpio/gpio.h> here as well and keep alphabetical order..

Use the GPIO_ACTIVE_LOW and GPIO_ACTIVE_HIGH macros afterwards in stead of 1 and 0 in the gpio parameters.

Check the recent ramips board additions for examples.

Copy link
Contributor

Choose a reason for hiding this comment

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

Drop this node. the spi node is disabled by default in mt7621.dtsi.

Copy link
Contributor

Choose a reason for hiding this comment

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

Something is wrong here. The firmware and the kernel partition are having the same start address. Drop the firmware partition, you are having already the ubi partition.

Copy link
Contributor

@mkresin mkresin Feb 22, 2017

Choose a reason for hiding this comment

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

Drop this line and add the following instead:

IMAGE_SIZE := $(ralink_default_fw_size_32M)
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata

That should create the correct image format for sysupgrade.

If the sysupgrade.bin you created is intended for the first installation of LEDE (maybe via bootloader) use the following:

IMAGE_SIZE := $(ralink_default_fw_size_32M)
IMAGES += factory.bin
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE)

Edit:

You need to add your board to the platform_pre_upgrade() function in target/linux/ramips/base-files/lib/upgrade/platform.sh to actually do the nand specific update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all corrected.Thanks for you help!

Copy link
Contributor

Choose a reason for hiding this comment

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

You add "kmod-usb-ledtrig-usbport" module, but you not defined any led as usbport.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is unnecessary tab.

label = "hc5962:white:status";
gpios = <&gpio0 6 0>;
};

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is unnecessary tab.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary tab.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary tab.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary tab.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary tab.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary tab.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary tab.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks!

@liudf0716
Copy link

good advice

@gigibox
Copy link
Contributor Author

gigibox commented Feb 23, 2017

Thanks a lot for the review and comments. ^^

Copy link
Contributor

@mkresin mkresin left a comment

Choose a reason for hiding this comment

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

Please add a comment with a serial log which shows:

  • the boot of the OEM firmware
  • the switch to LEDE from the OEM software
  • the LEDE boot
  • sysupgrade lede-ramips-mt7621-hc5962-sysupgrade.bin

This way we can ensure that at least the basic stuff is tested.

local board=$(ramips_board_name)

case "$board" in
ubnt-erx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please restore the former indentation!

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm quite sure the sysupgrade will fail at this point since your sysupgrade image doesn't start with the uImage magic 0x27051956.

The whole image header validation isn't required for the hc5962 since a validation based on the metadata will be done. Please add a new block for the hc5962 containing:

hc5962)
	# these boards use metadata images
	return 0
	;;

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the purpose of this blinking LED? I guess this can be removed, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi.
This device has only one indicator light, So, After the system starts, I hope the Indicator blink white to show system normal operation.
Image of Yaktocat

Copy link
Member

Choose a reason for hiding this comment

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

But you are already using status_led in /etc/diag.sh for this. Default behavior of status_led is to blink during system boot up process and stay on when system is booted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works like this:
hc5962-led-status2

Choose a reason for hiding this comment

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

when system boot, its red light blink, after booted, become white light blink.

Copy link
Member

Choose a reason for hiding this comment

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

Please, use then only the white LED for status_led in /etc/diag.sh instead of the red one and don't add anything else in /etc/board.d/01_leds. Using red LED could be misleading as this color is usually used to indicate some error and/or problem.

We have a common/general approach over whole code, for all targets, for status LED and there is no need to reproduce vendor firmware approach here.

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice. Thanks! That explains a lot! I'll do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

drop this partition. it has still the same start address on flash (0x140000) as the kernel partition. For NAND board you don't need a firmware partition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I just found it submission failed, is now complete.

reg = <0x340000 0x1E00000>;
};

partition@2140000 {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this partition is required to revert to the OEM firmware, mark the partition as read-only. If this partition is not required, drop the node and use the extra space for the ubi partition.

@gigibox
Copy link
Contributor Author

gigibox commented Feb 24, 2017

The-boot-of-the-OEM-firmware.txt
switch-to-LEDE-from-OEM-software.txt
do-sysupgrade-lede-sysupgrade-bin.txt

@mkresin
Copy link
Contributor

mkresin commented Feb 26, 2017

With your latest changes you broke the sysupgrade again. Have you tested the sysupgrade with your latest changes?

You dropped the following requested changes with your last push:

It is not necessary to do the nand_do_platform_check for the hc5962, since the validation is done via metadata.

It was fine the way it was before your last change. You have just added to much in indentation.

@gigibox
Copy link
Contributor Author

gigibox commented Feb 27, 2017

@mkresin Please forgive my ignorance. I have changed it as you suggested and has been tested. Thank you again for you time on this matter.

hc5962-lede-test-sysupgrade.txt

@mkresin
Copy link
Contributor

mkresin commented Feb 27, 2017

Look really good to me. One last remark.

In the ethernet node of the DTS you read the mac address as hex values from the factory partition. But later in the boot process you replace this mac address with the ASCII values read from the bdinfo partition (target/linux/ramips/base-files/etc/board.d/02_network). Either of them seam to be wrong to me. Any explanation for this?

In your bootlog the following can be seen:

[   10.100000] mt76x2e 0000:02:00.0: ASIC revision: 76120044
[   10.100000] mt76x2e 0000:02:00.0: EEPROM data check failed: 7603
[   10.110000] mt76x2e 0000:02:00.0: Invalid MAC address, using random address 7e:dd:3f:8b:49:e8
[   10.130000] mt76x2e 0000:02:00.0: ROM patch already applied
[   10.130000] mt76x2e 0000:02:00.0: Firmware Version: 0.0.00
[   10.140000] mt76x2e 0000:02:00.0: Build: 1
[   10.140000] mt76x2e 0000:02:00.0: Build Time: 201507311614____
[   10.170000] mt76x2e 0000:02:00.0: Firmware running!
[   10.180000] mt7603e 0000:01:00.0: ASIC revision: 76030010
[   12.260000] mt7603e 0000:01:00.0: Firmware Version: _mt7603mp
[   12.270000] mt7603e 0000:01:00.0: Build Time: 20151020155902

Not sure about this, but could it be that something is wrong with the EEPROM of the mt76@1,0 (0000:02:00.0) wireless? Maybe you have defined the wrong position on flash?

This patch adds supports for the HiWiFi HC5962(gee4) http://www.hiwifi.com

Short specification:

 - MT7621AT + MT7612EN + 7603EN
 - 256MB DDR3 RAM
 - 128MB NAND flash
 - 1+3 x 1000M Ethernet
 - 1x USB 2.0 port. 1x USB 3.0 port.
 - reset button
 - UART pad on PCB (JP3: TX, RX, GND, 3.3V)

Flash instruction:

1, Download lede-ramips-mt7621-hc5962-squashfs-factory.bin
2, Login as root via SSH on 192.168.199.1 and then copy factory.bin(using wget or nc or...) to /tmp/
3, use the following commands:
   $ mtd write /tmp/lede-ramips-mt7621-hc5962-squashfs-factory.bin firmware
   $ mtd erase firmware_backup && reboot
After reboot you should be able to login as root via SSH on 192.168.1.1

Signed-off-by: ZengFei Zhang <zhangzengfei@kunteng.org>
@gigibox
Copy link
Contributor Author

gigibox commented Feb 28, 2017

Yes, mkresin, you are right, I adjusted the reading position of the eeprom, Now it works very well, Signal is stable and reliable.

In addition, HiWiFi use bdinfo parition to save MAC address, The ethernet node of the DTS have since been deleted.

Thanks!

[    9.990000] mt7603e 0000:01:00.0: ASIC revision: 76030010
[   12.040000] mt7603e 0000:01:00.0: Firmware Version: _mt7603mp
[   12.040000] mt7603e 0000:01:00.0: Build Time: 20151020155902
[   12.090000] firmware init done
[   12.260000] mt76x2e 0000:02:00.0: ASIC revision: 76120044
[   12.280000] mt76x2e 0000:02:00.0: ROM patch already applied
[   12.340000] mt76x2e 0000:02:00.0: Firmware Version: 0.0.00
[   12.350000] mt76x2e 0000:02:00.0: Build: 1
[   12.350000] mt76x2e 0000:02:00.0: Build Time: 201507311614____
[   12.380000] mt76x2e 0000:02:00.0: Firmware running!

wireless

Full log:
hc5962-lede-upgrade-bootlog.txt

@liudf0716
Copy link

@mkresin I have submitted a pull request for update libevent days ago, but why no member reviewed my PR, either no member gave me advise or suggestion. here is my PR
#848

@mkresin mkresin self-assigned this Feb 28, 2017
@mkresin
Copy link
Contributor

mkresin commented Feb 28, 2017

Merged! Thanks for the PR and thanks a lot to all reviewers.

@mkresin mkresin closed this Feb 28, 2017
@gigibox gigibox deleted the patch-hc5962 branch March 1, 2017 02:11
@SouHong
Copy link

SouHong commented Aug 26, 2017

HC5962.dts-ok.tar.gz

#for usr 2.0:

gpio_export {
	compatible = "gpio-export";
	#size-cells = <0>;

	usbpower {
		gpio-export,name = "usbpower";
		gpio-export,output = <0>;
		gpios = <&gpio0 12 0>;
	};
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments