linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Paweł Chmiel" <pawel.mikolaj.chmiel@gmail.com>
To: kyungmin.park@samsung.com
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	bbrezillon@kernel.org, richard@nod.at,
	linux-kernel@vger.kernel.org,
	"Tomasz Figa" <tomasz.figa@gmail.com>,
	marek.vasut@gmail.com, robh+dt@kernel.org,
	linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com,
	computersforpeace@gmail.com, dwmw2@infradead.org,
	"Paweł Chmiel" <pawel.mikolaj.chmiel@gmail.com>
Subject: [PATCH 2/5] mtd: onenand/samsung: Make sure that bus clock is enabled
Date: Fri, 26 Apr 2019 18:42:21 +0200	[thread overview]
Message-ID: <20190426164224.11327-3-pawel.mikolaj.chmiel@gmail.com> (raw)
In-Reply-To: <20190426164224.11327-1-pawel.mikolaj.chmiel@gmail.com>

From: Tomasz Figa <tomasz.figa@gmail.com>

This patch adds basic handling of controller bus clock to make sure that
in device probe it is enabled and device can operate correctly. The
clock is optional and driver behavior is identical as before this patch
if not provided.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
 drivers/mtd/nand/onenand/samsung.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mtd/nand/onenand/samsung.c b/drivers/mtd/nand/onenand/samsung.c
index a425f19a3876..9628bf5bc397 100644
--- a/drivers/mtd/nand/onenand/samsung.c
+++ b/drivers/mtd/nand/onenand/samsung.c
@@ -14,6 +14,7 @@
  *	S5PC110: use DMA
  */
 
+#include <linux/clk.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/sched.h>
@@ -125,6 +126,7 @@ enum soc_type {
 struct s3c_onenand {
 	struct mtd_info	*mtd;
 	struct platform_device	*pdev;
+	struct clk	*clk_bus;
 	enum soc_type	type;
 	void __iomem	*ctrl_base;
 	void __iomem	*chip_base;
@@ -916,6 +918,10 @@ static int s3c_onenand_probe(struct platform_device *pdev)
 		}
 	}
 
+	onenand->clk_bus = devm_clk_get(&pdev->dev, "bus");
+	if (!IS_ERR(onenand->clk_bus))
+		clk_prepare_enable(onenand->clk_bus);
+
 	err = onenand_scan(mtd, 1);
 	if (err)
 		return err;
@@ -947,6 +953,8 @@ static int s3c_onenand_remove(struct platform_device *pdev)
 	struct mtd_info *mtd = platform_get_drvdata(pdev);
 
 	onenand_release(mtd);
+	if (!IS_ERR(onenand->clk_bus))
+		clk_disable_unprepare(onenand->clk_bus);
 
 	return 0;
 }
-- 
2.20.1


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

  parent reply	other threads:[~2019-04-26 16:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 16:42 [PATCH 0/5] mtd: onenand/samsung: Add device tree support Paweł Chmiel
2019-04-26 16:42 ` [PATCH 1/5] mtd: onenand/samsung: Unify resource order for controller variants Paweł Chmiel
2019-04-29  8:16   ` Miquel Raynal
2019-04-26 16:42 ` Paweł Chmiel [this message]
2019-04-29  8:18   ` [PATCH 2/5] mtd: onenand/samsung: Make sure that bus clock is enabled Miquel Raynal
2019-04-26 16:42 ` [PATCH 3/5] mtd: onenand/samsung: Add device tree support Paweł Chmiel
2019-04-29  8:21   ` Miquel Raynal
2019-04-26 16:42 ` [PATCH 4/5] dt-binding: " Paweł Chmiel
2019-05-02  1:54   ` Rob Herring
2019-05-02  6:23     ` Tomasz Figa
2019-05-02  6:36       ` Boris Brezillon
2019-05-02  6:42         ` Tomasz Figa
2019-05-02  6:55           ` Boris Brezillon
2019-05-02  6:58             ` Tomasz Figa
2019-05-02  7:21               ` Boris Brezillon
2019-05-02  8:41                 ` Tomasz Figa
2019-04-26 16:42 ` [PATCH 5/5] mtd: onenand/samsung: Set name field of mtd_info struct Paweł Chmiel
2019-04-29  8:22   ` Miquel Raynal
2019-04-29  8:19 ` [PATCH 0/5] mtd: onenand/samsung: Add device tree support Miquel Raynal
2019-04-29 14:42   ` Paweł Chmiel

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=20190426164224.11327-3-pawel.mikolaj.chmiel@gmail.com \
    --to=pawel.mikolaj.chmiel@gmail.com \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=tomasz.figa@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).