[OpenWrt-Devel] 回复:[PATCH] ramips: reset m25p80 when shutdown
Instead of use the set_4byte function in spi-nor.c, I use this patch for simplest modification. In fact, set_4byte also send 0xe9 command to the spi flash. Signed-off-by: Shonn Lu --- .../0064-reset-m25p80-when-shutdown.patch | 27 ++ 1 file changed, 27 insertions(+) create mode 100644 target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch diff --git a/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch new file mode 100644 index 000..aca758d --- /dev/null +++ b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch @@ -0,0 +1,27 @@ +--- a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c +@@ -322,6 +322,16 @@ + { + struct m25p *flash = spi_get_drvdata(spi); + ++ if ((&flash->spi_nor)->addr_width > 3) { ++ printk(KERN_INFO "m25p80: exit 4-byte address mode\n"); ++ flash->command[0] = SPINOR_OP_EX4B; // exit 4-byte address mode: 0xe9 ++ spi_write(flash->spi, flash->command, 1); ++ flash->command[0] = 0x66; // enable reset ++ spi_write(flash->spi, flash->command, 1); ++ flash->command[0] = 0x99; // reset ++ spi_write(flash->spi, flash->command, 1); ++ } ++ + /* Clean up MTD stuff. */ + return mtd_device_unregister(&flash->mtd); + } +@@ -385,6 +395,7 @@ + .id_table = m25p_ids, + .probe = m25p_probe, + .remove = m25p_remove, ++ .shutdown = m25p_remove, // add shutdown method to reset spi flash + + /* REVISIT: many of these chips have deep power-down modes, which +* should clearly be entered on suspend() to minimize power use. -- 1.9.1___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] 回复: [PATCH] ramips: reset m25p80 when shutdown
http://www.winbond.com.tw/resource-files/w25q256fv_revh_02112015.pdf The datasheet above shows that w25q256fv also use E9h to exit 4-Byte mode.___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] 回复: [PATCH] ramips: reset m25p80 when shutdown
I do not test this patch on all the 32MB spi flash except my Youku YK1 router.I am looking forward to a generic shutdown function which adapt to Macronix or Winbond. Cheers Shonn___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] RE: [PATCH] ramips: reset m25p80 when shutdown
Yes, I'd like to submit it to mainline.For 32MB spi flash, The mt7620a soc switch to 32bit address mode.After a soft reset, the spi flash should switch to 24bit back, otherwise the rourer would hang until you do a hard reset. -- 原始邮件 -- 发件人: "Rafał Miłecki";; 发送时间: 2015年11月9日(星期一) 凌晨5:25 收件人: "未命名"; 抄送: "OpenWrt Development List"; 主题: Re: [OpenWrt-Devel] [PATCH] ramips: reset m25p80 when shutdown On 7 November 2015 at 21:42, Shonn Lu wrote: > Signed-off-by: Shonn Lu > --- > .../0064-reset-m25p80-when-shutdown.patch | 24 > ++ > 1 file changed, 24 insertions(+) > create mode 100644 > target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch > > diff --git > a/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch > b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch > new file mode 100644 > index 000..76f916a > --- /dev/null > +++ b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch > @@ -0,0 +1,24 @@ > +--- a/drivers/mtd/devices/m25p80.c > b/drivers/mtd/devices/m25p80.c > +@@ -319,6 +319,12 @@ > + { > + struct m25p *flash = spi_get_drvdata(spi); > + > ++//play4fun: add spi flash reset code > ++ flash->command[0] = 0x66; > ++ spi_write(flash->spi, flash->command, 1); > ++ flash->command[0] = 0x99; > ++ spi_write(flash->spi, flash->command, 1); > ++ > + /* Clean up MTD stuff. */ > + return mtd_device_unregister(&flash->mtd); > + } > +@@ -382,6 +388,8 @@ > + .id_table = m25p_ids, > + .probe = m25p_probe, > + .remove = m25p_remove, > ++ // play4fun add shutdown method to reset spi flash > ++ .shutdown = m25p_remove, What's the point with that "play4fun" something? Please describe this patch better, explain why it is needed. Did you try to submit this patch to mainline? -- Rafał___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] [packages] generic :add-missing-ubi*-in-ramfs-when-sysupgrade
This patch may fix the sysupgrade with xxx-squashfs-sysupgrade.tar file by adding missing other ubi* in ramfs. Signed-off-by: Shonn Lu --- diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 761b4c1..78bd65f 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -67,6 +67,7 @@ run_ramfs() { # [...] install_bin /usr/sbin/ubirsvol install_bin /usr/sbin/ubirmvol install_bin /usr/sbin/ubimkvol + install_bin /usr/sbin/ubi* for file in $RAMFS_COPY_BIN; do install_bin ${file//:/ } done___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel