From: Brian Norris <computersforpeace@gmail.com>
To: Anup Patel <anup.patel@broadcom.com>
Cc: linux-arm-kernel@lists.infradead.org,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
David Woodhouse <dwmw2@infradead.org>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Pramod KUMAR <pramodku@broadcom.com>,
Vikram Prakash <vikramp@broadcom.com>,
Sandeep Tripathy <tripathy@broadcom.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mtd@lists.infradead.org,
bcm-kernel-feedback-list@broadcom.com,
Rafal Milecki <zajec5@gmail.com>
Subject: Re: [PATCH 3/5] mtd: brcmnand: Optional DT flag to reset IPROC NAND controller
Date: Sun, 4 Oct 2015 22:49:43 +0100 [thread overview]
Message-ID: <20151004214943.GA28904@localhost> (raw)
In-Reply-To: <1443808606-21203-4-git-send-email-anup.patel@broadcom.com>
+ Rafal (to extend this mighty CC list)
On Fri, Oct 02, 2015 at 11:26:44PM +0530, Anup Patel wrote:
> The BRCM NAND controller on NS2 SoC requires a reset to
> cleanup previously configured NAND controller state.
>
> This patch adds optional boolean device tree flag named
> "brcm,nand-iproc-reset". If this flag is present in NAND
> controller DT node then BRCM IPROC NAND driver will reset
> the NAND controller before any commands are issued.
Is there a reason not to do this reset unconditionally? I recall this
came up in discussion previously, when the OpenWRT folks were trying to
integrate with BCMA, where this reset was one of the few differences
between the platform-device-based driver (i.e., this one) and the BCMA
based driver. Might it help simplify things a bit if we just did the
same thing everywhere?
Brian
> Signed-off-by: Anup Patel <anup.patel@broadcom.com>
> Reviewed-by: Pramod KUMAR <pramodku@broadcom.com>
> Reviewed-by: Ray Jui <rjui@broadcom.com>
> Reviewed-by: Scott Branden <sbranden@broadcom.com>
> ---
> drivers/mtd/nand/brcmnand/iproc_nand.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/mtd/nand/brcmnand/iproc_nand.c b/drivers/mtd/nand/brcmnand/iproc_nand.c
> index 683495c..d837207 100644
> --- a/drivers/mtd/nand/brcmnand/iproc_nand.c
> +++ b/drivers/mtd/nand/brcmnand/iproc_nand.c
> @@ -11,6 +11,7 @@
> * GNU General Public License for more details.
> */
>
> +#include <linux/delay.h>
> #include <linux/device.h>
> #include <linux/io.h>
> #include <linux/ioport.h>
> @@ -35,6 +36,10 @@ struct iproc_nand_soc_priv {
> #define IPROC_NAND_APB_LE_MODE BIT(24)
> #define IPROC_NAND_INT_CTRL_READ_ENABLE BIT(6)
>
> +#define IPROC_NAND_RESET_OFFSET 0x3f8
> +#define IPROC_NAND_RESET_BIT_SHIFT 0
> +#define IPROC_NAND_RESET_BIT BIT(IPROC_NAND_RESET_BIT_SHIFT)
> +
> static bool iproc_nand_intc_ack(struct brcmnand_soc *soc)
> {
> struct iproc_nand_soc_priv *priv = soc->priv;
> @@ -93,6 +98,7 @@ static void iproc_nand_apb_access(struct brcmnand_soc *soc, bool prepare)
>
> static int iproc_nand_probe(struct platform_device *pdev)
> {
> + u32 reset;
> struct device *dev = &pdev->dev;
> struct iproc_nand_soc_priv *priv;
> struct brcmnand_soc *soc;
> @@ -124,6 +130,19 @@ static int iproc_nand_probe(struct platform_device *pdev)
> soc->ctlrdy_set_enabled = iproc_nand_intc_set;
> soc->prepare_data_bus = iproc_nand_apb_access;
>
> + if (of_property_read_bool(dev->of_node, "brcm,nand-iproc-reset")) {
> + /* Put controller in reset and wait 10 usecs */
> + reset = readl(priv->idm_base + IPROC_NAND_RESET_OFFSET);
> + reset |= IPROC_NAND_RESET_BIT;
> + writel(reset, priv->idm_base + IPROC_NAND_RESET_OFFSET);
> + udelay(10);
> + /* Bring controller out of reset and wait 10 usecs */
> + reset = readl(priv->idm_base + IPROC_NAND_RESET_OFFSET);
> + reset &= ~IPROC_NAND_RESET_BIT;
> + writel(reset, priv->idm_base + IPROC_NAND_RESET_OFFSET);
> + udelay(10);
> + }
> +
> return brcmnand_probe(pdev, soc);
> }
>
> --
> 1.9.1
>
next prev parent reply other threads:[~2015-10-04 21:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 17:56 [PATCH 0/5] NAND support for Broadcom NS2 SoC Anup Patel
2015-10-02 17:56 ` [PATCH 1/5] mtd: brcmnand: Fix pointer type-cast in brcmnand_write() Anup Patel
[not found] ` <1443808606-21203-2-git-send-email-anup.patel-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-10-12 21:20 ` Brian Norris
2015-10-02 17:56 ` [PATCH 2/5] mtd: nand: Allow MTD_NAND_BRCMNAND to be selected for ARM64 Anup Patel
2015-10-12 21:20 ` Brian Norris
2015-10-02 17:56 ` [PATCH 3/5] mtd: brcmnand: Optional DT flag to reset IPROC NAND controller Anup Patel
2015-10-04 21:49 ` Brian Norris [this message]
2015-10-05 6:27 ` Anup Patel
2015-10-06 13:41 ` Brian Norris
2015-10-06 22:25 ` Scott Branden
[not found] ` <56144A62.70300-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-10-06 23:20 ` Florian Fainelli
2015-10-07 3:33 ` Anup Patel
[not found] ` <39063E8F96E11742B35A201CC5D095B7AD8ADD-HXj2mutaA2qau4nib9vn7Zr/X4hKkxxPpWgKQ6/u3Fg@public.gmane.org>
2015-10-12 21:27 ` Brian Norris
[not found] ` <20151012212742.GQ107187-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-10-16 6:46 ` Anup Patel
2015-10-12 21:54 ` Josh Cartwright
2015-10-13 17:35 ` Florian Fainelli
2015-10-02 17:56 ` [PATCH 4/5] Documentation: dt-bindings: Add info about brcm,nand-iproc-reset DT flag Anup Patel
2015-10-02 17:56 ` [PATCH 5/5] arm64: dts: Add BRCM IPROC NAND DT node for NS2 Anup Patel
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=20151004214943.GA28904@localhost \
--to=computersforpeace@gmail.com \
--cc=anup.patel@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=catalin.marinas@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=f.fainelli@gmail.com \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=pramodku@broadcom.com \
--cc=rjui@broadcom.com \
--cc=robh+dt@kernel.org \
--cc=sbranden@broadcom.com \
--cc=tripathy@broadcom.com \
--cc=vikramp@broadcom.com \
--cc=will.deacon@arm.com \
--cc=zajec5@gmail.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;
as well as URLs for NNTP newsgroup(s).