* [PATCH v7 1/2] mtd: nand: sunxi: update DT bindings
@ 2016-06-24 5:00 Icenowy Zheng
[not found] ` <20160624050005.31186-1-icenowy-ymACFijhrKM@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Icenowy Zheng @ 2016-06-24 5:00 UTC (permalink / raw)
To: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, richard-/L3Ra7n9ekc,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
computersforpeace-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng
Document the reset lines
Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
---
Changes in v7:
- Rebased for nand/next branch.
- Merged the two part of "Optional properties" of nand/next's document
into one part.
Documentation/devicetree/bindings/mtd/sunxi-nand.txt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/mtd/sunxi-nand.txt b/Documentation/devicetree/bindings/mtd/sunxi-nand.txt
index 6fdf8f6..b040ed4 100644
--- a/Documentation/devicetree/bindings/mtd/sunxi-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/sunxi-nand.txt
@@ -14,17 +14,17 @@ Required properties:
Optional properties:
- dmas : shall reference DMA channel associated to the NAND controller.
- dma-names : shall be "rxtx".
-
-Optional children nodes:
-Children nodes represent the available nand chips.
-
-Optional properties:
+- reset : phandle + reset specifier pair
+- reset-names : shall be "ahb" if present
- allwinner,rb : shall contain the native Ready/Busy ids.
or
- rb-gpios : shall contain the gpios used as R/B pins.
- nand-ecc-mode : one of the supported ECC modes ("hw", "hw_syndrome", "soft",
"soft_bch" or "none")
+Optional children nodes:
+Children nodes represent the available nand chips.
+
see Documentation/devicetree/bindings/mtd/nand.txt for generic bindings.
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v7 2/2] mtd: nand: sunxi: add reset line support
[not found] ` <20160624050005.31186-1-icenowy-ymACFijhrKM@public.gmane.org>
@ 2016-06-24 5:00 ` Icenowy Zheng
2016-06-24 9:37 ` [PATCH v7 1/2] mtd: nand: sunxi: update DT bindings Boris Brezillon
1 sibling, 0 replies; 3+ messages in thread
From: Icenowy Zheng @ 2016-06-24 5:00 UTC (permalink / raw)
To: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, richard-/L3Ra7n9ekc,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
computersforpeace-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Icenowy Zheng
The NAND controller on some sun8i chips needs its reset line to be
deasserted before they can enter working state.
Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
---
Changes in v2:
- Corrected the error checking code of reset line.
Changes in v3:
- Corrected a more serious error brought in the "fix" of v2.
Changes in v4:
- Removed unneeded code block after "else".
Changes in v5:
- Added reassertion code in case of initialization error and device
remove.
Changes in v6:
- Fixed a resource leak by not using goto to exit in case of error.
Changes in v7:
- Rebased for nand/next branch.
drivers/mtd/nand/sunxi_nand.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index f582fe4..77796da 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -39,6 +39,7 @@
#include <linux/gpio.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
+#include <linux/reset.h>
#define NFC_REG_CTL 0x0000
#define NFC_REG_ST 0x0004
@@ -270,6 +271,7 @@ struct sunxi_nfc {
void __iomem *regs;
struct clk *ahb_clk;
struct clk *mod_clk;
+ struct reset_control *reset;
unsigned long assigned_cs;
unsigned long clk_rate;
struct list_head chips;
@@ -2209,15 +2211,28 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
if (ret)
goto out_ahb_clk_unprepare;
+ nfc->reset = devm_reset_control_get_optional(dev, "ahb");
+
+ if (!IS_ERR(nfc->reset)) {
+ ret = reset_control_deassert(nfc->reset);
+ if (ret) {
+ dev_err(dev, "reset err %d\n", ret);
+ goto out_mod_clk_unprepare;
+ }
+ } else if (PTR_ERR(nfc->reset) != -ENOENT) {
+ ret = PTR_ERR(nfc->reset);
+ goto out_mod_clk_unprepare;
+ }
+
ret = sunxi_nfc_rst(nfc);
if (ret)
- goto out_mod_clk_unprepare;
+ goto out_ahb_reset_reassert;
writel(0, nfc->regs + NFC_REG_INT);
ret = devm_request_irq(dev, irq, sunxi_nfc_interrupt,
0, "sunxi-nand", nfc);
if (ret)
- goto out_mod_clk_unprepare;
+ goto out_ahb_reset_reassert;
nfc->dmac = dma_request_slave_channel(dev, "rxtx");
if (nfc->dmac) {
@@ -2247,6 +2262,9 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
out_release_dmac:
if (nfc->dmac)
dma_release_channel(nfc->dmac);
+out_ahb_reset_reassert:
+ if (!IS_ERR(nfc->reset))
+ reset_control_assert(nfc->reset);
out_mod_clk_unprepare:
clk_disable_unprepare(nfc->mod_clk);
out_ahb_clk_unprepare:
@@ -2262,6 +2280,10 @@ static int sunxi_nfc_remove(struct platform_device *pdev)
sunxi_nand_chips_cleanup(nfc);
if (nfc->dmac)
dma_release_channel(nfc->dmac);
+
+ if (!IS_ERR(nfc->reset))
+ reset_control_assert(nfc->reset);
+
clk_disable_unprepare(nfc->mod_clk);
clk_disable_unprepare(nfc->ahb_clk);
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v7 1/2] mtd: nand: sunxi: update DT bindings
[not found] ` <20160624050005.31186-1-icenowy-ymACFijhrKM@public.gmane.org>
2016-06-24 5:00 ` [PATCH v7 2/2] mtd: nand: sunxi: add reset line support Icenowy Zheng
@ 2016-06-24 9:37 ` Boris Brezillon
1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2016-06-24 9:37 UTC (permalink / raw)
To: Icenowy Zheng
Cc: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, richard-/L3Ra7n9ekc,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
computersforpeace-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Fri, 24 Jun 2016 13:00:04 +0800
Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org> wrote:
> Document the reset lines
>
> Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
Applied both.
Thanks,
Boris
> ---
> Changes in v7:
> - Rebased for nand/next branch.
> - Merged the two part of "Optional properties" of nand/next's document
> into one part.
>
> Documentation/devicetree/bindings/mtd/sunxi-nand.txt | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mtd/sunxi-nand.txt b/Documentation/devicetree/bindings/mtd/sunxi-nand.txt
> index 6fdf8f6..b040ed4 100644
> --- a/Documentation/devicetree/bindings/mtd/sunxi-nand.txt
> +++ b/Documentation/devicetree/bindings/mtd/sunxi-nand.txt
> @@ -14,17 +14,17 @@ Required properties:
> Optional properties:
> - dmas : shall reference DMA channel associated to the NAND controller.
> - dma-names : shall be "rxtx".
> -
> -Optional children nodes:
> -Children nodes represent the available nand chips.
> -
> -Optional properties:
> +- reset : phandle + reset specifier pair
> +- reset-names : shall be "ahb" if present
> - allwinner,rb : shall contain the native Ready/Busy ids.
> or
> - rb-gpios : shall contain the gpios used as R/B pins.
> - nand-ecc-mode : one of the supported ECC modes ("hw", "hw_syndrome", "soft",
> "soft_bch" or "none")
>
> +Optional children nodes:
> +Children nodes represent the available nand chips.
> +
> see Documentation/devicetree/bindings/mtd/nand.txt for generic bindings.
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-24 9:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 5:00 [PATCH v7 1/2] mtd: nand: sunxi: update DT bindings Icenowy Zheng
[not found] ` <20160624050005.31186-1-icenowy-ymACFijhrKM@public.gmane.org>
2016-06-24 5:00 ` [PATCH v7 2/2] mtd: nand: sunxi: add reset line support Icenowy Zheng
2016-06-24 9:37 ` [PATCH v7 1/2] mtd: nand: sunxi: update DT bindings Boris Brezillon
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).