From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-mtd@lists.infradead.org,
Graham Moore <grmoore@opensource.altera.com>,
Dinh Nguyen <dinguyen@opensource.altera.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Richard Weinberger <richard@nod.at>,
Kumar Gala <galak@codeaurora.org>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Brian Norris <computersforpeace@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
David Woodhouse <dwmw2@infradead.org>,
Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] mtd: nand: denali: allow to override max_banks from DT property
Date: Fri, 25 Mar 2016 15:45:20 +0100 [thread overview]
Message-ID: <20160325154520.199b0863@bbrezillon> (raw)
In-Reply-To: <1458822277-31428-1-git-send-email-yamada.masahiro@socionext.com>
On Thu, 24 Mar 2016 21:24:37 +0900
Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Commit 271707b1d817 ("mtd: nand: denali: max_banks calculation
> changed in revision 5.1") supported the new encoding of the "n_banks"
> bits of the "features" register, but there is an unfortunate case
> that is not covered by that commit.
>
> Panasonic (its System LSI division is now Socionext) bought several
> versions of this IP. The IP released for Panasonic around Feb. 2012
> is revision 5 and uses the old encoding for n_banks (2 << n_banks).
> While the one released around Nov. 2012 is also revision 5, but it
> uses the new encoding (1 << n_banks).
>
> The revision register cannot distinguish these two incompatible
> hardware. I guess this IP series is not well-organized. I could not
> find any alternative but giving max_banks from DT property.
Hm, shouldn't that be addressed with a new compatible instead of adding
a extra property?
>
> This commit works around the problem by allowing DT to set the
> max_banks forcibly. Of course, this DT property can be optional if
> the auto detection based on the hardware registers works well.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> Documentation/devicetree/bindings/mtd/denali-nand.txt | 4 ++++
> drivers/mtd/nand/denali.c | 3 ++-
> drivers/mtd/nand/denali_dt.c | 3 +++
> 3 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/mtd/denali-nand.txt b/Documentation/devicetree/bindings/mtd/denali-nand.txt
> index 785b825..78c250d 100644
> --- a/Documentation/devicetree/bindings/mtd/denali-nand.txt
> +++ b/Documentation/devicetree/bindings/mtd/denali-nand.txt
> @@ -7,6 +7,10 @@ Required properties:
> - interrupts : The interrupt number.
> - dma-mask : DMA bit mask
>
> +Optional properties:
> + - max-banks : Maximum number of banks supported by hardware. If not
> + specified, it is determined based on the "features" register of hardware.
> +
You might want to prefix that with "denali,".
> The device tree may optionally contain sub-nodes describing partitions of the
> address space. See partition.txt for more detail.
>
> diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
> index 30bf5f6..e18b569 100644
> --- a/drivers/mtd/nand/denali.c
> +++ b/drivers/mtd/nand/denali.c
> @@ -1353,7 +1353,8 @@ static void denali_hw_init(struct denali_nand_info *denali)
> */
> denali->bbtskipbytes = ioread32(denali->flash_reg +
> SPARE_AREA_SKIP_BYTES);
> - detect_max_banks(denali);
> + if (!denali->max_banks)
> + detect_max_banks(denali);
> denali_nand_reset(denali);
> iowrite32(0x0F, denali->flash_reg + RB_PIN_ENABLED);
> iowrite32(CHIP_EN_DONT_CARE__FLAG,
> diff --git a/drivers/mtd/nand/denali_dt.c b/drivers/mtd/nand/denali_dt.c
> index 0cb1e8d..be55db8 100644
> --- a/drivers/mtd/nand/denali_dt.c
> +++ b/drivers/mtd/nand/denali_dt.c
> @@ -85,6 +85,9 @@ static int denali_dt_probe(struct platform_device *ofdev)
> denali->dev->dma_mask = NULL;
> }
>
> + of_property_read_u32(ofdev->dev.of_node, "max-banks",
> + &denali->max_banks);
> +
> dt->clk = devm_clk_get(&ofdev->dev, NULL);
> if (IS_ERR(dt->clk)) {
> dev_err(&ofdev->dev, "no clk available\n");
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2016-03-25 14:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-24 12:24 [PATCH] mtd: nand: denali: allow to override max_banks from DT property Masahiro Yamada
2016-03-24 12:24 ` Masahiro Yamada
2016-03-25 14:37 ` Rob Herring
2016-03-25 14:37 ` Rob Herring
2016-03-25 14:45 ` Boris Brezillon [this message]
2016-03-26 4:27 ` Masahiro Yamada
2016-03-29 7:53 ` Boris Brezillon
2016-03-29 7:53 ` Boris Brezillon
2016-04-02 5:14 ` Masahiro Yamada
2016-04-02 14:03 ` 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=20160325154520.199b0863@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dinguyen@opensource.altera.com \
--cc=dwmw2@infradead.org \
--cc=galak@codeaurora.org \
--cc=grmoore@opensource.altera.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=richard@nod.at \
--cc=robh+dt@kernel.org \
--cc=yamada.masahiro@socionext.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.