public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: <Tudor.Ambarus@microchip.com>
To: <figgyc@figgyc.uk>
Cc: richard@nod.at, linux-mtd@lists.infradead.org, vigneshr@ti.com,
	linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com
Subject: Re: [PATCH] mtd: spi-nor: boya: add support for boya by25q128as
Date: Mon, 8 Feb 2021 10:21:13 +0000	[thread overview]
Message-ID: <0c5b8a0c-7bd2-a15e-ee25-0adec9430e8a@microchip.com> (raw)
In-Reply-To: <20210207123032.516207-1-figgyc@figgyc.uk>

Hi, George,

On 2/7/21 2:30 PM, George Brooke wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Adds support for the Boya Microelectronics BY25Q128AS 128 Mbit flash.
> I tested this on the Creality WB-01 embedded device which uses this,
> although that was with OpenWrt which is still using 5.4 so I had to
> do a bit of porting work. Don't see how that would make much of a
> difference though.
> 
> Signed-off-by: George Brooke <figgyc@figgyc.uk>
> ---
>  drivers/mtd/spi-nor/Makefile |  1 +
>  drivers/mtd/spi-nor/boya.c   | 23 +++++++++++++++++++++++
>  drivers/mtd/spi-nor/core.c   |  1 +
>  drivers/mtd/spi-nor/core.h   |  1 +
>  4 files changed, 26 insertions(+)
>  create mode 100644 drivers/mtd/spi-nor/boya.c
> 
> diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
> index 653923896205..7d1551fbfbaa 100644
> --- a/drivers/mtd/spi-nor/Makefile
> +++ b/drivers/mtd/spi-nor/Makefile
> @@ -2,6 +2,7 @@
> 
>  spi-nor-objs                   := core.o sfdp.o
>  spi-nor-objs                   += atmel.o
> +spi-nor-objs                   += boya.o
>  spi-nor-objs                   += catalyst.o
>  spi-nor-objs                   += eon.o
>  spi-nor-objs                   += esmt.o
> diff --git a/drivers/mtd/spi-nor/boya.c b/drivers/mtd/spi-nor/boya.c
> new file mode 100644
> index 000000000000..014b0087048a
> --- /dev/null
> +++ b/drivers/mtd/spi-nor/boya.c
> @@ -0,0 +1,23 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2005, Intec Automation Inc.
> + * Copyright (C) 2014, Freescale Semiconductor, Inc.
> + */
> +
> +#include <linux/mtd/spi-nor.h>
> +
> +#include "core.h"
> +
> +static const struct flash_info boya_parts[] = {
> +       /* Boya */
> +       { "by25q128as", INFO(0x684018, 0, 64 * 1024, 256,

The manufacturer’s identification code is defined by one or more
eight (8) bit fields each consisting of seven (7) data bits plus one (1)
odd parity bit. It is a single field limiting the possible number of
vendors to 126. To expand the maximum number of identification codes a
continuation scheme has been defined.

According to JEP106BA, the manufacturer ID for Boya should be preceded by
eight continuation codes. So I would expect the manufacturer ID for this
flash to be: 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x68.

Without the continuation codes, we will have collisions between
manufacturer IDs, Convex Computer being an example.

I see that the datasheet [1] for this flash doesn't specify anything
about the continuation codes, so I suspect that Boya just got it wrong.
We'll have to check other datasheets from Boya and see if they got
their manufacturer ID wrong for all their flashes. We'll have to add
some fixup mechanism for the manufacturers ID handling, in order to
avoid collisions with other manufacturers IDs.

Cheers,
ta

[1] https://datasheet.lcsc.com/szlcsc/1904091402_BOYAMICRO-BY25Q128ASSIG_C383794.pdf

> +                       SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
> +                       SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
> +       },
> +};
> +
> +const struct spi_nor_manufacturer spi_nor_boya = {
> +       .name = "boya",
> +       .parts = boya_parts,
> +       .nparts = ARRAY_SIZE(boya_parts),
> +};
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 20df44b753da..4d0d003e9c3f 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -2160,6 +2160,7 @@ int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor)
> 
>  static const struct spi_nor_manufacturer *manufacturers[] = {
>         &spi_nor_atmel,
> +       &spi_nor_boya,
>         &spi_nor_catalyst,
>         &spi_nor_eon,
>         &spi_nor_esmt,
> diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
> index d631ee299de3..d5ed5217228b 100644
> --- a/drivers/mtd/spi-nor/core.h
> +++ b/drivers/mtd/spi-nor/core.h
> @@ -409,6 +409,7 @@ struct spi_nor_manufacturer {
> 
>  /* Manufacturer drivers. */
>  extern const struct spi_nor_manufacturer spi_nor_atmel;
> +extern const struct spi_nor_manufacturer spi_nor_boya;
>  extern const struct spi_nor_manufacturer spi_nor_catalyst;
>  extern const struct spi_nor_manufacturer spi_nor_eon;
>  extern const struct spi_nor_manufacturer spi_nor_esmt;
> --
> 2.30.0
> 

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

       reply	other threads:[~2021-02-08 10:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210207123032.516207-1-figgyc@figgyc.uk>
2021-02-08 10:21 ` Tudor.Ambarus [this message]
     [not found]   ` <87eehj3nd5.fsf@figgyc.uk>
2021-04-06  5:35     ` [PATCH] mtd: spi-nor: boya: add support for boya by25q128as Tudor.Ambarus
2021-04-06 15:32       ` Chris Morgan
2021-04-06 16:11       ` George Brooke
2021-04-07  6:20         ` Tudor.Ambarus
2021-04-07  6:25           ` Tudor.Ambarus

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=0c5b8a0c-7bd2-a15e-ee25-0adec9430e8a@microchip.com \
    --to=tudor.ambarus@microchip.com \
    --cc=figgyc@figgyc.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox