public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Aaron Sierra <asierra@xes-inc.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>
Cc: linux-mtd <linux-mtd@lists.infradead.org>
Subject: [PATCH v2 2/2] mtd: cfi: Add early fixup for S70GL02GS
Date: Mon, 30 Apr 2018 11:35:07 -0500 (CDT)	[thread overview]
Message-ID: <1111011589.117630.1525106107675.JavaMail.zimbra@xes-inc.com> (raw)

S70GL02GS flash reports a single 256 MiB chip, but is really made up
of two 128 MiB chips with 1024 sectors each.

Without early fixups (top half of device cannot be written or erased):
  ff0000000.nor-boot: Found 1 x16 devices at 0x0 in 16-bit bank. <snip>
  Amd/Fujitsu Extended Query Table at 0x0040
    Amd/Fujitsu Extended Query version 1.5.
  number of CFI chips: 1

With early fixups (entire device can be written and erased):
  Bad S70GL02GS CFI data; adjust to detect 2 chips
  ff0000000.nor-boot: Found 1 x16 devices at 0x0 in 16-bit bank. <snip>
  ff0000000.nor-boot: Found 1 x16 devices at 0x8000000 in 16-bit bank
  Amd/Fujitsu Extended Query Table at 0x0040
    Amd/Fujitsu Extended Query version 1.5.
  number of CFI chips: 2

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
---
 drivers/mtd/chips/cfi_probe.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c
index c05deac..65f3ab0 100644
--- a/drivers/mtd/chips/cfi_probe.c
+++ b/drivers/mtd/chips/cfi_probe.c
@@ -174,7 +174,19 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
 	return 1;
 }
 
+static void fixup_s70gl02gs_chips(struct cfi_private *cfi)
+{
+	/*
+	 * S70GL02GS flash reports a single 256 MiB chip, but is really made up
+	 * of two 128 MiB chips with 1024 sectors each.
+	 */
+	cfi->cfiq->DevSize = 27;
+	cfi->cfiq->EraseRegionInfo[0] = 0x20003ff;
+	pr_warn("Bad S70GL02GS CFI data; adjust to detect 2 chips\n");
+}
+
 static struct cfi_early_fixup cfi_early_fixup_table[] = {
+	{ CFI_MFR_AMD, 0x4801, fixup_s70gl02gs_chips },
 	{ 0, 0, NULL },
 };
 
-- 
2.7.4

             reply	other threads:[~2018-04-30 16:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30 16:35 Aaron Sierra [this message]
2018-05-03  9:35 ` [PATCH v2 2/2] mtd: cfi: Add early fixup for S70GL02GS Boris Brezillon
2018-05-03 14:33   ` Aaron Sierra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1111011589.117630.1525106107675.JavaMail.zimbra@xes-inc.com \
    --to=asierra@xes-inc.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox