|
关于歌华链有很多的硬件版本,常见的是12-V0.3-2018/02/22
Q12-V0.4-2018/03/23
本人恰巧有这2个型号的机器。基本上V0.3版本刷大多数固件都可以正常启动和软重启。
当你发现在breed下刷入大多数固件后设备无法启动;又或是成功启动固件了,但只能拔电源才能重启时,说明你的歌华链是V0.4版本的。
此版本需要做如下补丁,才能正常使用(本人只在Chaos_Calmer 3.18内核下测试成功)。(附件里有适配于CC下的DTS)
歌华链V0.4版本 openwrt CC-3.18.45固件分享(无线驱动backports了18.06.2的mac80211和MT76-2018-10-01-plus版本):
链接:https://pan.baidu.com/s/1KFbTSuLWClaT9VwHhrZOvA
提取码:nxr3
--- a/drivers/mtd/spi-nor/spi-nor.c 2019-03-22 02:23:02.198651000 +0800
+++ b/drivers/mtd/spi-nor/spi-nor.c 2019-03-22 11:39:08.776000000 +0800
@@ -781,7 +781,7 @@
{ "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) },
{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
- { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) },
+ { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
{ "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) },
{ "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) },
--- a/drivers/mtd/spi-nor/spi-nor.c 2019-03-22 13:13:41.940000000 +0800
+++ b/drivers/mtd/spi-nor/spi-nor.c 2019-03-22 20:48:38.028000000 +0800
@@ -908,11 +909,12 @@
{ },
};
-static const struct flash_info *spi_nor_read_id(struct spi_nor *nor)
+static const struct flash_info *spi_nor_read_id(struct spi_nor *nor,
+ const char *name)
{
int tmp;
u8 id[SPI_NOR_MAX_ID_LEN];
- const struct flash_info *info;
+ const struct flash_info *info, *first_match = NULL;
tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
if (tmp < 0) {
@@ -923,10 +925,16 @@
for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) {
info = &spi_nor_ids[tmp];
if (info->id_len) {
- if (!memcmp(info->id, id, info->id_len))
- return &spi_nor_ids[tmp];
+ if (!memcmp(info->id, id, info->id_len)) {
+ if (!name || !strcmp(name, info->name))
+ return info;
+ if (!first_match)
+ first_match = info;
+ }
}
}
+ if (first_match)
+ return first_match;
dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %2x, %2x\n",
id[0], id[1], id[2]);
return ERR_PTR(-ENODEV);
@@ -1239,7 +1247,7 @@
info = spi_nor_match_id(name);
/* Try to auto-detect if chip name wasn't specified or not found */
if (!info)
- info = spi_nor_read_id(nor);
+ info = spi_nor_read_id(nor, NULL);
if (IS_ERR_OR_NULL(info))
return -ENOENT;
@@ -1250,7 +1258,7 @@
if (name && info->id_len) {
const struct flash_info *jinfo;
- jinfo = spi_nor_read_id(nor);
+ jinfo = spi_nor_read_id(nor, name);
if (IS_ERR(jinfo)) {
return PTR_ERR(jinfo);
} else if (jinfo != info) {
--- a/drivers/mtd/devices/m25p80.c 2016-10-22 15:30:19.000000000 +0800
+++ b/drivers/mtd/devices/m25p80.c 2016-12-07 19:40:30.000000000 +0800
@@ -321,6 +321,12 @@
static int m25p_remove(struct spi_device *spi)
{
struct m25p *flash = spi_get_drvdata(spi);
+ 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->spi_nor.mtd);
@@ -385,6 +396,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.
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|