public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Bean Huo <beanhuo@outlook.com>
Cc: "dwmw2@infradead.org" <dwmw2@infradead.org>,
	"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
	"boris.brezillon@free-elections.com"
	<boris.brezillon@free-elections.com>,
	"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
	"richard@nod.at" <richard@nod.at>,
	"cyrille.pitchen@wedev4u.fr" <cyrille.pitchen@wedev4u.fr>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	beanhuo <beanhuo@micron.com>
Subject: Re: [PATCH v1 2/3] mtd: probe: probe dual die entry from devicetree binding
Date: Thu, 22 Feb 2018 14:02:53 +0100	[thread overview]
Message-ID: <20180222140253.1773d3ce@bbrezillon> (raw)
In-Reply-To: <DM2PR12MB001471EC3E5B6841C61ED9FEA6CE0@DM2PR12MB0014.namprd12.prod.outlook.com>

On Wed, 21 Feb 2018 19:32:34 +0000
Bean Huo <beanhuo@outlook.com> wrote:

> From: beanhuo <beanhuo@micron.com>
> 
> The device_stack property now will be initialized when devicetree
> has an entry compatible with "dual_die_stack".
> 
> Signed-off-by: beanhuo <beanhuo@micron.com>
> ---
>  drivers/mtd/chips/cfi_probe.c | 7 +++++++
>  include/linux/mtd/cfi.h       | 8 ++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c
> index e8d0164..6182406 100644
> --- a/drivers/mtd/chips/cfi_probe.c
> +++ b/drivers/mtd/chips/cfi_probe.c
> @@ -17,6 +17,7 @@
>  #include <linux/mtd/map.h>
>  #include <linux/mtd/cfi.h>
>  #include <linux/mtd/gen_probe.h>
> +#include <linux/of_platform.h>
>  
>  //#define DEBUG_CFI
>  
> @@ -159,6 +160,7 @@ static int __xipram cfi_chip_setup(struct map_info *map,
>  	int num_erase_regions = cfi_read_query(map, base + (0x10 + 28)*ofs_factor);
>  	int i;
>  	int addr_unlock1 = 0x555, addr_unlock2 = 0x2AA;
> +	struct device_node __maybe_unused *np = map->device_node;

You can drop this variable...

>  
>  	xip_enable(base, map, cfi);
>  #ifdef DEBUG_CFI
> @@ -177,6 +179,11 @@ static int __xipram cfi_chip_setup(struct map_info *map,
>  
>  	cfi->sector_erase_cmd = CMD(0x30);
>  
> +	cfi->device_stack = CFI_DEVICESTACK_1DIE;
> +#ifdef CONFIG_OF
> +	if (np && of_property_read_bool(np, "dual-die-stack"))
> +		cfi->device_stack = CFI_DEVICESTACK_2DIE;
> +#endif

and simply do:

	if (of_property_read_bool(map->device_node, "dual-die-stack"))
		cfi->device_stack = CFI_DEVICESTACK_2DIE;

>  	/* Read the CFI info structure */
>  	xip_disable_qry(base, map, cfi);
>  	for (i=0; i<(sizeof(struct cfi_ident) + num_erase_regions * 4); i++)
> diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
> index 9b57a9b..bda37a4 100644
> --- a/include/linux/mtd/cfi.h
> +++ b/include/linux/mtd/cfi.h
> @@ -277,11 +277,19 @@ struct cfi_bri_query {
>  #define CFI_MODE_CFI	1
>  #define CFI_MODE_JEDEC	0
>  
> +/* These values represent the die count of chip stack.
> + * So far, there only exists two type of stack device,
> + * single or dual die.
> + */
> +#define CFI_DEVICESTACK_1DIE	1
> +#define CFI_DEVICESTACK_2DIE	2

Why are these macros needed?

> +
>  struct cfi_private {
>  	uint16_t cmdset;
>  	void *cmdset_priv;
>  	int interleave;
>  	int device_type;
> +	int device_stack;	/* Device stack type, single die or dual die. */

Why not simply:

	int num_dies;

which would contain the number of dies.

>  	int cfi_mode;		/* Are we a JEDEC device pretending to be CFI? */
>  	int addr_unlock1;
>  	int addr_unlock2;



-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-02-22 13:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1519241514-6466-1-git-send-email-beanhuo@outlook.com>
2018-02-21 19:32 ` [PATCH v1 1/3] mtd: physmap: add dual die entry in devicetree binding Bean Huo
2018-02-22 13:05   ` Boris Brezillon
2018-02-23 11:07     ` Bean Huo
2018-02-23 15:53       ` Boris Brezillon
2018-02-21 19:32 ` [PATCH v1 2/3] mtd: probe: probe dual die entry from " Bean Huo
2018-02-22 13:02   ` Boris Brezillon [this message]
2018-02-23 11:14     ` Bean Huo
2018-02-21 19:32 ` [PATCH v1 3/3] drivers: mtd: chips: add support for the dual die stacked PNOR Bean Huo
2018-02-22 13:33   ` Boris Brezillon
2018-02-23 11:43     ` Bean Huo
2018-02-23 15:49       ` Boris Brezillon

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=20180222140253.1773d3ce@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=beanhuo@micron.com \
    --cc=beanhuo@outlook.com \
    --cc=boris.brezillon@free-elections.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    /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