Solutions for ZBT-WG3526 reboot broken

Following is our solution and descrption for this problem; I found it in a website . The final solution is in the end of this email ;

The latest kernel (3.14.28) of openWRT has been able to support the reading and writing and erasing function for 32M SPI Flash.
However, the system may be ill-considered, or it is the BUG of MT7620 system ,after in the configuration of W25Q256 on the MT7620 development board system , Can not soft reset!After access to relevant information and found that, MT7620 default support for 24bit (3byte) spi address mode, and to support more than 32M spi flash, you must switch to 32bit (4byte) address mode.In soft reset, Spi stay in the 32bit mode, there is no switch back to the default 24bit mode, resulting in reset, MT7620 in the default 24bit mode,can not connect with 32bit mode's Spi, the system crashes.Then the problem comes: how to let spi Flash switch back to 24bit mode when soft reseting? This article through the device driver in a shutdown method to solve this problem.

background knowledge
In the Linux source kernel directory, there is a reboot. C file, it exposes a register_reboot_notifier method, can let the kernel of the code to have access to reboot notification, as we continue to analyze reboot. C code, will find more interesting things:

Photo missed
In kernel_restart, again call kernel_restart_prepare method:
photo missed
Device_shutdown in drivers/base/core c implementation:
photo missed

By reading the code, it is easy to find, in device_shutdown, enumerated the shutdown method of the equipment, if there is, the method will be come out.
As a result, the reset method of 32 m spi flash and mind jumps out.

Go to drivers / mtd / devices / m25p80.c
Modify the following code:

photo missed

Pls feel free to ask me if you have any questions!

Best regards

email: skype: zbt-sales02