All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Magnus Damm <magnus.damm@gmail.com>,
	Marek Vasut <marek.vasut+renesas@gmail.com>,
	 Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	linux-renesas-soc@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH/RFC] ARM: dts: marzen: Add FLASH node
Date: Mon, 20 Mar 2023 19:57:44 +0100	[thread overview]
Message-ID: <CAMuHMdXE=jvjKTekRgWpYRPa7_T51qRdTXTgB3nQn5Dcjjg7bA@mail.gmail.com> (raw)
In-Reply-To: <4afd79ba-215d-8b33-4999-4afaa88ae051@linaro.org>

Hi Tudor,

On Mon, Mar 20, 2023 at 6:04 PM Tudor Ambarus <tudor.ambarus@linaro.org> wrote:
> Vignesh used to review CFI code, maybe he can intervene. I've never
> worked with CFI, but I can try to help. I'll need more debug data though.
>
> On 3/20/23 16:43, Geert Uytterhoeven wrote:
> > Add a device node for the Spansion S29GL512N NOR FLASH on the Marzen
> > development board.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > Although the S29GL512N is a CFI FLASH, using "cfi-flash" instead of
> > "mtd-rom" does not work:
> >   1. Probing fails with "physmap-flash 0.flash: map_probe failed",
>
> I would first try to understand why the probe fails.

With debug code added, I saw that cfi_probe_chip() fails because
cfi_qry_mode_on() returns zero.  Printing actual vs. expected values
in map_word_equal() showed that nothing was read (all 0xff, IIRC).

Forcing big-endian (CONFIG_MTD_CFI_BE_BYTE_SWAP=y) didn't
help, and caused an unaligned access crash.

> >   2. The kernel crashes later in a spectacular way, cfr. the logs below.
> >
> > U-Boot flinfo says:
> >
> >     Bank # 1: CFI conformant flash (16 x 16)  Size: 64 MB in 512 Sectors
> >       AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E
> >       Erase timeout: 4096 ms, write timeout: 1 ms
> >       Buffer write timeout: 3 ms, buffer size: 64 bytes
> >       Sector Start Addresses:
> >       00000000   RO   00020000        00040000   RO   00060000   RO   00080000
> >       000A0000        000C0000        000E0000        00100000        00120000
> >       00140000        00160000        00180000        001A0000        001C0000
> >       ...
> >       03FC0000        03FE0000
> >
> >     Bank # 2: missing or unknown FLASH type
>
> Do you use "cfi-flash" compatible in u-boot and it works just fine? If
> yes, I would try to understand what are the differences between the
> probe paths from u-boot and linux. I know it doesn't help much, but we
> should start from somewhere if we don't have any other feedback.

It's a bit more complicated... This is a rather old board, and I only
have the originally installed U-Boot 2011.03, and no U-Boot sources.

U-Boot can write to the FLASH, as "saveenv" works (env at  0x40000).

Thanks for your help!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Magnus Damm <magnus.damm@gmail.com>,
	Marek Vasut <marek.vasut+renesas@gmail.com>,
	 Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	linux-renesas-soc@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH/RFC] ARM: dts: marzen: Add FLASH node
Date: Mon, 20 Mar 2023 19:57:44 +0100	[thread overview]
Message-ID: <CAMuHMdXE=jvjKTekRgWpYRPa7_T51qRdTXTgB3nQn5Dcjjg7bA@mail.gmail.com> (raw)
In-Reply-To: <4afd79ba-215d-8b33-4999-4afaa88ae051@linaro.org>

Hi Tudor,

On Mon, Mar 20, 2023 at 6:04 PM Tudor Ambarus <tudor.ambarus@linaro.org> wrote:
> Vignesh used to review CFI code, maybe he can intervene. I've never
> worked with CFI, but I can try to help. I'll need more debug data though.
>
> On 3/20/23 16:43, Geert Uytterhoeven wrote:
> > Add a device node for the Spansion S29GL512N NOR FLASH on the Marzen
> > development board.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > Although the S29GL512N is a CFI FLASH, using "cfi-flash" instead of
> > "mtd-rom" does not work:
> >   1. Probing fails with "physmap-flash 0.flash: map_probe failed",
>
> I would first try to understand why the probe fails.

With debug code added, I saw that cfi_probe_chip() fails because
cfi_qry_mode_on() returns zero.  Printing actual vs. expected values
in map_word_equal() showed that nothing was read (all 0xff, IIRC).

Forcing big-endian (CONFIG_MTD_CFI_BE_BYTE_SWAP=y) didn't
help, and caused an unaligned access crash.

> >   2. The kernel crashes later in a spectacular way, cfr. the logs below.
> >
> > U-Boot flinfo says:
> >
> >     Bank # 1: CFI conformant flash (16 x 16)  Size: 64 MB in 512 Sectors
> >       AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E
> >       Erase timeout: 4096 ms, write timeout: 1 ms
> >       Buffer write timeout: 3 ms, buffer size: 64 bytes
> >       Sector Start Addresses:
> >       00000000   RO   00020000        00040000   RO   00060000   RO   00080000
> >       000A0000        000C0000        000E0000        00100000        00120000
> >       00140000        00160000        00180000        001A0000        001C0000
> >       ...
> >       03FC0000        03FE0000
> >
> >     Bank # 2: missing or unknown FLASH type
>
> Do you use "cfi-flash" compatible in u-boot and it works just fine? If
> yes, I would try to understand what are the differences between the
> probe paths from u-boot and linux. I know it doesn't help much, but we
> should start from somewhere if we don't have any other feedback.

It's a bit more complicated... This is a rather old board, and I only
have the originally installed U-Boot 2011.03, and no U-Boot sources.

U-Boot can write to the FLASH, as "saveenv" works (env at  0x40000).

Thanks for your help!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Magnus Damm <magnus.damm@gmail.com>,
	Marek Vasut <marek.vasut+renesas@gmail.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-renesas-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH/RFC] ARM: dts: marzen: Add FLASH node
Date: Mon, 20 Mar 2023 19:57:44 +0100	[thread overview]
Message-ID: <CAMuHMdXE=jvjKTekRgWpYRPa7_T51qRdTXTgB3nQn5Dcjjg7bA@mail.gmail.com> (raw)
In-Reply-To: <4afd79ba-215d-8b33-4999-4afaa88ae051@linaro.org>

Hi Tudor,

On Mon, Mar 20, 2023 at 6:04 PM Tudor Ambarus <tudor.ambarus@linaro.org> wrote:
> Vignesh used to review CFI code, maybe he can intervene. I've never
> worked with CFI, but I can try to help. I'll need more debug data though.
>
> On 3/20/23 16:43, Geert Uytterhoeven wrote:
> > Add a device node for the Spansion S29GL512N NOR FLASH on the Marzen
> > development board.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > Although the S29GL512N is a CFI FLASH, using "cfi-flash" instead of
> > "mtd-rom" does not work:
> >   1. Probing fails with "physmap-flash 0.flash: map_probe failed",
>
> I would first try to understand why the probe fails.

With debug code added, I saw that cfi_probe_chip() fails because
cfi_qry_mode_on() returns zero.  Printing actual vs. expected values
in map_word_equal() showed that nothing was read (all 0xff, IIRC).

Forcing big-endian (CONFIG_MTD_CFI_BE_BYTE_SWAP=y) didn't
help, and caused an unaligned access crash.

> >   2. The kernel crashes later in a spectacular way, cfr. the logs below.
> >
> > U-Boot flinfo says:
> >
> >     Bank # 1: CFI conformant flash (16 x 16)  Size: 64 MB in 512 Sectors
> >       AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E
> >       Erase timeout: 4096 ms, write timeout: 1 ms
> >       Buffer write timeout: 3 ms, buffer size: 64 bytes
> >       Sector Start Addresses:
> >       00000000   RO   00020000        00040000   RO   00060000   RO   00080000
> >       000A0000        000C0000        000E0000        00100000        00120000
> >       00140000        00160000        00180000        001A0000        001C0000
> >       ...
> >       03FC0000        03FE0000
> >
> >     Bank # 2: missing or unknown FLASH type
>
> Do you use "cfi-flash" compatible in u-boot and it works just fine? If
> yes, I would try to understand what are the differences between the
> probe paths from u-boot and linux. I know it doesn't help much, but we
> should start from somewhere if we don't have any other feedback.

It's a bit more complicated... This is a rather old board, and I only
have the originally installed U-Boot 2011.03, and no U-Boot sources.

U-Boot can write to the FLASH, as "saveenv" works (env at  0x40000).

Thanks for your help!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2023-03-20 18:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 16:43 [PATCH/RFC] ARM: dts: marzen: Add FLASH node Geert Uytterhoeven
2023-03-20 16:43 ` Geert Uytterhoeven
2023-03-20 16:43 ` Geert Uytterhoeven
2023-03-20 17:04 ` Tudor Ambarus
2023-03-20 17:04   ` Tudor Ambarus
2023-03-20 17:04   ` Tudor Ambarus
2023-03-20 18:57   ` Geert Uytterhoeven [this message]
2023-03-20 18:57     ` Geert Uytterhoeven
2023-03-20 18:57     ` Geert Uytterhoeven
2023-03-21 15:01     ` Geert Uytterhoeven
2023-03-21 15:01       ` Geert Uytterhoeven
2023-03-21 15:01       ` Geert Uytterhoeven
2023-04-03 16:29       ` Geert Uytterhoeven
2023-04-03 16:29         ` Geert Uytterhoeven
2023-04-03 16:29         ` Geert Uytterhoeven
2023-04-07  7:16         ` Tudor Ambarus
2023-04-07  7:16           ` Tudor Ambarus
2023-04-07  7:16           ` Tudor Ambarus
2023-04-10  9:25           ` Geert Uytterhoeven
2023-04-10  9:25             ` Geert Uytterhoeven
2023-04-10  9:25             ` Geert Uytterhoeven
2023-08-31 11:19             ` Geert Uytterhoeven
2023-08-31 11:19               ` Geert Uytterhoeven
2023-08-31 11:19               ` Geert Uytterhoeven

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='CAMuHMdXE=jvjKTekRgWpYRPa7_T51qRdTXTgB3nQn5Dcjjg7bA@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@linaro.org \
    --cc=vigneshr@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.