Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
c0a05bd1
Commit
c0a05bd1
authored
3 months ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
flash debugging
parent
5a0466e2
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
patches/openwrt/0008-mt76-import-MT7915-recovery-fixes.patch
+0
-0
0 additions, 0 deletions
patches/openwrt/0008-mt76-import-MT7915-recovery-fixes.patch
patches/openwrt/0009-add-patch-for-flash-debugging.patch
+151
-0
151 additions, 0 deletions
patches/openwrt/0009-add-patch-for-flash-debugging.patch
with
151 additions
and
0 deletions
patches/openwrt/00
1
0-mt76-import-MT7915-recovery-fixes.patch
→
patches/openwrt/000
8
-mt76-import-MT7915-recovery-fixes.patch
+
0
−
0
View file @
c0a05bd1
File moved
This diff is collapsed.
Click to expand it.
patches/openwrt/0009-add-patch-for-flash-debugging.patch
0 → 100644
+
151
−
0
View file @
c0a05bd1
From: Nico <github@nicoboehr.de>
Date: Sun, 9 Mar 2025 11:05:38 +0000
Subject: add patch for flash debugging
diff --git a/target/linux/ath79/patches-6.6/910-flashdebug.patch b/target/linux/ath79/patches-6.6/910-flashdebug.patch
new file mode 100644
index 0000000000000000000000000000000000000000..239cc92b973a8989ac65aa8ebd7447823b01ee6a
--- /dev/null
+++ b/target/linux/ath79/patches-6.6/910-flashdebug.patch
@@ -0,0 +1,141 @@
+--- a/drivers/mtd/mtdcore.c
++++ b/drivers/mtd/mtdcore.c
+@@ -6,6 +6,7 @@
+ * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
+ * Copyright © 2006 Red Hat UK Limited
+ */
++#define DEBUG
+
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+@@ -2299,20 +2300,29 @@ EXPORT_SYMBOL_GPL(mtd_lock);
+ int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
+ {
+ struct mtd_info *master = mtd_get_master(mtd);
++ int r;
+
+- if (!master->_unlock)
++ if (!master->_unlock) {
++ printk("mtd: no unlock operation for %s\n", mtd->name);
+ return -EOPNOTSUPP;
+- if (ofs < 0 || ofs >= mtd->size || len > mtd->size - ofs)
++ }
++ if (ofs < 0 || ofs >= mtd->size || len > mtd->size - ofs) {
++ printk("mtd: unlock out of band for %s\n", mtd->name);
+ return -EINVAL;
+- if (!len)
++ }
++ if (!len) {
++ printk("mtd: zero length %s\n", mtd->name);
+ return 0;
++ }
+
+ if (mtd->flags & MTD_SLC_ON_MLC_EMULATION) {
+ ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize;
+ len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize;
+ }
+
+- return master->_unlock(master, mtd_get_master_ofs(mtd, ofs), len);
++ r = master->_unlock(master, mtd_get_master_ofs(mtd, ofs), len);
++ printk("mtd_unlock: %s return %d\n", mtd->name, r);
++ return r;
+ }
+ EXPORT_SYMBOL_GPL(mtd_unlock);
+
+--- a/drivers/mtd/spi-nor/core.c
++++ b/drivers/mtd/spi-nor/core.c
+@@ -6,6 +6,7 @@
+ * Copyright (C) 2005, Intec Automation Inc.
+ * Copyright (C) 2014, Freescale Semiconductor, Inc.
+ */
++#define DEBUG
+
+ #include <linux/err.h>
+ #include <linux/errno.h>
+--- a/fs/jffs2/build.c
++++ b/fs/jffs2/build.c
+@@ -119,12 +119,12 @@ static int jffs2_build_filesystem(struct
+
+ if (c->flags & (1 << 7)) {
+ printk("%s(): unlocking the mtd device... ", __func__);
+- mtd_unlock(c->mtd, 0, c->mtd->size);
+- printk("done.\n");
++ ret = mtd_unlock(c->mtd, 0, c->mtd->size);
++ printk("unlock done with ret=%d.\n", ret);
+
+ printk("%s(): erasing all blocks after the end marker... ", __func__);
+- jffs2_erase_pending_blocks(c, -1);
+- printk("done.\n");
++ ret = jffs2_erase_pending_blocks(c, -1);
++ printk("erase done with ret=%d.\n", ret);
+ }
+
+ dbg_fsbuild("pass 1 starting\n");
+--- a/drivers/mtd/spi-nor/swp.c
++++ b/drivers/mtd/spi-nor/swp.c
+@@ -253,15 +253,21 @@ static int spi_nor_sr_unlock(struct spi_
+ bool can_be_top = true, can_be_bottom = nor->flags & SNOR_F_HAS_SR_TB;
+ bool use_top;
+
++ printk("nor->flags = %x\n", nor->flags);
++
+ ret = spi_nor_read_sr(nor, nor->bouncebuf);
+- if (ret)
++ if (ret) {
++ printk("spi_nor_sr_unlock: spi_no_read_sr() failed with %d\n", ret);
+ return ret;
++ }
+
+ status_old = nor->bouncebuf[0];
+
+ /* If nothing in our range is locked, we don't need to do anything */
+- if (spi_nor_is_unlocked_sr(nor, ofs, len, status_old))
++ if (spi_nor_is_unlocked_sr(nor, ofs, len, status_old)) {
++ printk("spi_nor_sr_unlock: already unlocked");
+ return 0;
++ }
+
+ /* If anything below us is locked, we can't use 'top' protection */
+ if (!spi_nor_is_unlocked_sr(nor, 0, ofs, status_old))
+@@ -272,8 +278,10 @@ static int spi_nor_sr_unlock(struct spi_
+ status_old))
+ can_be_bottom = false;
+
+- if (!can_be_bottom && !can_be_top)
++ if (!can_be_bottom && !can_be_top) {
++ printk("spi_nor_sr_unlock: ofs=%lld len=%llu mtd->size=%llu\n", ofs, len, mtd->size);
+ return -EINVAL;
++ }
+
+ /* Prefer top, if both are valid */
+ use_top = can_be_top;
+@@ -295,8 +303,10 @@ static int spi_nor_sr_unlock(struct spi_
+ val = (val & ~SR_BP3) | SR_BP3_BIT6;
+
+ /* Some power-of-two sizes are not supported */
+- if (val & ~mask)
++ if (val & ~mask) {
++ printk("spi_nor_sr_unlock: unsupported power of two: val=%x mask=%x\n", val, mask);
+ return -EINVAL;
++ }
+ }
+
+ status_new = (status_old & ~mask & ~tb_mask) | val;
+@@ -313,10 +323,15 @@ static int spi_nor_sr_unlock(struct spi_
+ return 0;
+
+ /* Only modify protection if it will not lock other areas */
+- if ((status_new & mask) > (status_old & mask))
++ if ((status_new & mask) > (status_old & mask)) {
++ printk("spi_nor_sr_unlock: status_new=%x status_old=%x\n", status_new, status_old);
+ return -EINVAL;
++ }
+
+- return spi_nor_write_sr_and_check(nor, status_new);
++ ret = spi_nor_write_sr_and_check(nor, status_new);
++ if (ret)
++ printk("spi_nor_sr_unlock: spi_nor_write_sr_and_check failed with %d\n", ret);
++ return ret;
+ }
+
+ /*
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment