From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZkJKr-0001lH-6z for barebox@lists.infradead.org; Thu, 08 Oct 2015 22:06:50 +0000 Received: by wicfx3 with SMTP id fx3so46999408wic.1 for ; Thu, 08 Oct 2015 15:06:27 -0700 (PDT) From: Sebastian Hesselbarth Date: Fri, 9 Oct 2015 00:06:04 +0200 Message-Id: <1444341979-19157-3-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1444341979-19157-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1444341979-19157-1-git-send-email-sebastian.hesselbarth@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 02/17] mtd: nand_mrvl_nfc: Use common clock for core clock To: Sebastian Hesselbarth Cc: Thomas Petazzoni , barebox@lists.infradead.org, Ezequiel Garcia With PXA3xx now providing a common clock for the NAND clock, use it and get rid of the mach/clock.h. This will allow Marvell Armada 370/XP to reuse the same driver. Signed-off-by: Sebastian Hesselbarth --- Cc: Robert Jarzmik Cc: Thomas Petazzoni Cc: Ezequiel Garcia Cc: barebox@lists.infradead.org --- drivers/mtd/nand/nand_mrvl_nfc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/nand_mrvl_nfc.c b/drivers/mtd/nand/nand_mrvl_nfc.c index 1ec48cc09e59..bdf949de0e7f 100644 --- a/drivers/mtd/nand/nand_mrvl_nfc.c +++ b/drivers/mtd/nand/nand_mrvl_nfc.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -135,6 +134,7 @@ struct mrvl_nand_host { struct nand_chip chip; struct mtd_partition *parts; struct device_d *dev; + struct clk *core_clk; /* calculated from mrvl_nand_flash data */ unsigned int col_addr_cycles; @@ -281,10 +281,10 @@ static struct mrvl_nand_timing timings[] = { static void mrvl_nand_set_timing(struct mrvl_nand_host *host, bool use_default) { struct mtd_info *mtd = &host->mtd; + unsigned long nand_clk = clk_get_rate(host->core_clk); struct mrvl_nand_timing *t; uint32_t ndtr0, ndtr1; u16 id; - unsigned long nand_clk = pxa_get_nandclk(); if (use_default) { id = 0; @@ -954,6 +954,13 @@ static struct mrvl_nand_host *alloc_nand_resource(struct device_d *dev) free(host); return host->mmio_base; } + host->core_clk = clk_get(dev, NULL); + if (IS_ERR(host->core_clk)) { + free(host); + return (void *)host->core_clk; + } + clk_enable(host->core_clk); + if (pdata) { host->keep_config = pdata->keep_config; host->flash_bbt = pdata->flash_bbt; -- 2.1.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox