dgiese
August 20, 2017, 4:58pm
35
root@LEDE:/tmp# sysupgrade lede-ramips-mt7620-miwifi-r3-squashfs-sysupgrade.tar
Invalid image type.
Image check 'platform_check_image' failed.
Note: The internal lan (br-lan) is connected to the wrong interface. The router has 2 lan ports and 1 wan port. At the moment, br-lan is linked to the wan port.
Most likely board name or model are set wrong.
What does cat /proc/cpuinfo return?
I did not check how ports were connected because I assumed that they are same as is Mi Wifi Mini,but that can be solved.
First we need to get it working at all
dgiese
August 20, 2017, 5:02pm
37
Update (cpuinfo + sysupgrade -F)
root@LEDE:/tmp# cat /proc/cpuinfo
system type : MediaTek MT7620A ver:2 eco:6
machine : Xiaomi MiWiFi R3
processor : 0
cpu model : MIPS 24KEc V5.0
BogoMIPS : 385.84
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16 dsp
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
root@LEDE:/tmp# sysupgrade -n -F lede-ramips-mt7620-miwifi-r3-squashfs-sysupgrad
e.tar
Invalid image type.
Image check 'platform_check_image' failed but --force given - will update anyway!
killall: watchdog: no process killed
Commencing upgrade. All shell sessions will be closed now.
Watchdog handover: fd=3
- watchdog -
killall: telnetd: no process killed
Sending TERM to remaining processes ... ubusd logd netifd odhcpd ntpd dnsmasq
Sending KILL to remaining processes ...
Performing system upgrade...
Could not open mtd device: firmware
Can't open device for writing!
Upgrade completed
Rebooting system...
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource [ 65.851351] reboot: Restarting system
busy
umount: can't unmount /: Invalid argument
I have a feeling that sysupgrade is being denied because partitions do not match ones in sysupgrade.
Can you try following instructions for manual flash posted earlier in this thread?
I should get one R3 tommorow so I can also test
dgiese
August 20, 2017, 5:16pm
39
I guess sysupgrade fails, because there are no mtd-devices in /dev. Even the block-device for the nand flash is not visible.
It is most likely due to my bad port of NAND support from MT7621.
Problem is that patch that had NAND driver for MT7620 was dropped when kernel was updated to 4.9
We really need someone who knows more than me.
@dissent1 Any time to help?
1 Like
Try this layout in mi3 dts and remove it from 7620.dtsi
#include <dt-bindings/input/input.h>
/ {
compatible = "sercomm,na930", "ralink,mt7620a-soc";
model = "Sercomm NA930";
aliases {
led-status = &led_power;
};
chosen {
bootargs = "console=ttyS1,57600";
};
nand {
#address-cells = <1>;
#size-cells = <1>;
compatible = "mtk,mt7620-nand";
partition@0 {
label = "u-boot";
But I haven't found a driver that parses it, so if it doesn't work, try copying and adjusting this patch
From fb6e1578cd73d7d81f675e75247a676423f32412 Mon Sep 17 00:00:00 2001
From: John Crispin <blogic@openwrt.org>
Date: Sun, 17 Nov 2013 17:41:46 +0100
Subject: [PATCH 38/53] mtd: ralink: add mt7620 nand driver
Signed-off-by: John Crispin <blogic@openwrt.org>
---
drivers/mtd/maps/Kconfig | 4 +
drivers/mtd/maps/Makefile | 2 +
drivers/mtd/maps/ralink_nand.c | 2136 ++++++++++++++++++++++++++++++++++++++++
drivers/mtd/maps/ralink_nand.h | 232 +++++
4 files changed, 2374 insertions(+)
create mode 100644 drivers/mtd/maps/ralink_nand.c
create mode 100644 drivers/mtd/maps/ralink_nand.h
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -399,4 +399,8 @@ config MTD_LATCH_ADDR
If compiled as a module, it will be called latch-addr-flash.
This file has been truncated. show original
I have copied the patch but unfortunately it will require adjustments as it spews out errors.
Unfortunately,I have no idea where to start
according to this patch oobavail is in struct 'mtd' and not in 'ecclayout' anymore
committed 09:46AM - 07 Mar 16 UTC
ecclayout->oobavail is just redundant with the mtd->oobavail field.
Moreover, it prevents static const definition of ecc layouts since the
NAND framework is calculating...
But in ramips patch it points to ecclayout still
Seems like you need to make 1 more pointer to point to mtd->ooblayout, but that may require more work
In functions where you find 'ra->oob->oobavail'
Add the pointer 'struct mtd_info *mtd'
And then replace ''ra->oob->oobavail'' with 'mtd->oobavail'
Let's see how it goes
Or try just replacing it with 'ranfc_mtd->oobavail' without additional structs
+#endif
+ ra_outl(NFC_CTRL, ra_inl(NFC_CTRL) | 0x01); //set wp to high
+ nfc_all_reset();
+
+ ranfc_mtd->type = MTD_NANDFLASH;
+ ranfc_mtd->flags = MTD_CAP_NANDFLASH;
+ ranfc_mtd->size = CONFIG_NUMCHIPS * CFG_CHIPSIZE;
+ ranfc_mtd->erasesize = CFG_BLOCKSIZE;
+ ranfc_mtd->writesize = CFG_PAGESIZE;
+ ranfc_mtd->oobsize = CFG_PAGE_OOBSIZE;
+ ranfc_mtd->oobavail = RA_CHIP_OOB_AVAIL;
+ ranfc_mtd->name = "ra_nfc";
+ //ranfc_mtd->index
+ ranfc_mtd->ecclayout = &ra_oob_layout;
+ //ranfc_mtd->numberaseregions
+ //ranfc_mtd->eraseregions
+ //ranfc_mtd->bansize
+ ranfc_mtd->_erase = ramtd_nand_erase;
+ //ranfc_mtd->point
+ //ranfc_mtd->unpoint
+ ranfc_mtd->_read = ramtd_nand_read;
Ok,I will try it.
I tried to follow your instructions but failed.
Any chance you are willing to make those changes.
You can make a PR or tell me your github email to grant you access.
Okay, let's go the way around. Revert all your changes and replace every 'ra->oob->oobavail' with 'RA_CHIP_OOB_AVAIL' throughout the patch
Tried that,unfortunately there are still errors.
Copy
+ */
+
+static struct nand_ecclayout ra_oob_layout = {
+ .eccbytes = CONFIG_ECC_BYTES,
+ .eccpos = {5, 6, 7},
+ .oobfree = {
+ {.offset = 0, .length = 4},
+ {.offset = 8, .length = 8},
+ {.offset = 0, .length = 0}
+ },
+#define RA_CHIP_OOB_AVAIL (4+8)
+ .oobavail = RA_CHIP_OOB_AVAIL,
+ // 5th byte is bad-block flag.
+};
+
+static int
+mtk_nand_probe(struct platform_device *pdev)
+{
+ struct mtd_part_parser_data ppdata;
+ struct ra_nand_chip *ra;
+ int alloc_size, bbt_size, buffers_size, reg, err;
To line 67 or somewhere near
Ok,copied.
Trying to build it now.
Don't forget to increment
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -43,3 +43,5 @@ obj-$(CONFIG_MTD_VMU) += vmu-flash.o
obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o
obj-$(CONFIG_MTD_LATCH_ADDR) += latch-addr-flash.o
obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o
+obj-$(CONFIG_MTD_NAND_MT7620) += ralink_nand.o
+
--- /dev/null
+++ b/drivers/mtd/maps/ralink_nand.c
@@ -0,0 +1,2136 @@
+#define DEBUG
+#include <linux/device.h>
+#undef DEBUG
+#include <linux/slab.h>
+#include <linux/mtd/mtd.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/dma-mapping.h>
+#include <linux/mtd/partitions.h>
Should be 2137 now
I think it will not change as I used empty line that was already added
Unfortunately,the same error is present
gistfile1.txt
drivers/mtd/maps/ralink_nand.c: In function 'nand_write_oob_buf':
drivers/mtd/maps/ralink_nand.c:1419:22: error: dereferencing pointer to incomplete type 'struct nand_ecclayout'
for(free = ra->oob->oobfree; free->length && size; free++) {
^
In file included from ./include/linux/list.h:8:0,
from ./include/linux/kobject.h:20,
from ./include/linux/device.h:17,
from drivers/mtd/maps/ralink_nand.c:2:
drivers/mtd/maps/ralink_nand.c: In function 'nand_read_oob_buf':
./include/linux/kernel.h:739:16: warning: comparison of distinct pointer types lacks a cast
This file has been truncated. show original
Also,kernel was bumped to 4.9 although lack of NAND support was known
committed 11:38AM - 13 Feb 17 UTC
NAND support is missing
Signed-off-by: John Crispin <john@phrozen.org>
It's 1 error less now, will see if I can workaround this one