From: Christian Pellegrin <chripell@fsfe.org> To: ben-linux@fluff.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Christian Pellegrin <chripell@fsfe.org> Subject: [PATCH v2.6.34-rc2] s3c: Fix CONFIG_MTD_NAND_S3C2410_CLKSTOP Date: Tue, 30 Mar 2010 10:22:03 +0200 [thread overview] Message-ID: <1269937323-7541-1-git-send-email-chripell@fsfe.org> (raw) Option CONFIG_MTD_NAND_S3C2410_CLKSTOP was broken by higher MTD layers calling select_chip with -1 twice in a row. This patch fixes the problem by making sure that clk_disable is not called too many times. Signed-off-by: Christian Pellegrin <chripell@fsfe.org> --- drivers/mtd/nand/s3c2410.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index fa6e9c7..9adecc6 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -37,6 +37,7 @@ #include <linux/slab.h> #include <linux/clk.h> #include <linux/cpufreq.h> +#include <linux/bitops.h> #include <linux/mtd/mtd.h> #include <linux/mtd/nand.h> @@ -135,6 +136,9 @@ struct s3c2410_nand_info { #ifdef CONFIG_CPU_FREQ struct notifier_block freq_transition; #endif +#ifdef CONFIG_MTD_NAND_S3C2410_CLKSTOP + unsigned long clk_running; +#endif }; /* conversion functions */ @@ -333,7 +337,8 @@ static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip) nmtd = this->priv; info = nmtd->info; - if (chip != -1 && allow_clk_stop(info)) + if (chip != -1 && allow_clk_stop(info) && + !test_and_set_bit(0, &info->clk_running)) clk_enable(info->clk); cur = readl(info->sel_reg); @@ -356,7 +361,8 @@ static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip) writel(cur, info->sel_reg); - if (chip == -1 && allow_clk_stop(info)) + if (chip == -1 && allow_clk_stop(info) && + test_and_clear_bit(0, &info->clk_running)) clk_disable(info->clk); } -- 1.5.6.5
WARNING: multiple messages have this Message-ID (diff)
From: chripell@fsfe.org (Christian Pellegrin) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2.6.34-rc2] s3c: Fix CONFIG_MTD_NAND_S3C2410_CLKSTOP Date: Tue, 30 Mar 2010 10:22:03 +0200 [thread overview] Message-ID: <1269937323-7541-1-git-send-email-chripell@fsfe.org> (raw) Option CONFIG_MTD_NAND_S3C2410_CLKSTOP was broken by higher MTD layers calling select_chip with -1 twice in a row. This patch fixes the problem by making sure that clk_disable is not called too many times. Signed-off-by: Christian Pellegrin <chripell@fsfe.org> --- drivers/mtd/nand/s3c2410.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index fa6e9c7..9adecc6 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -37,6 +37,7 @@ #include <linux/slab.h> #include <linux/clk.h> #include <linux/cpufreq.h> +#include <linux/bitops.h> #include <linux/mtd/mtd.h> #include <linux/mtd/nand.h> @@ -135,6 +136,9 @@ struct s3c2410_nand_info { #ifdef CONFIG_CPU_FREQ struct notifier_block freq_transition; #endif +#ifdef CONFIG_MTD_NAND_S3C2410_CLKSTOP + unsigned long clk_running; +#endif }; /* conversion functions */ @@ -333,7 +337,8 @@ static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip) nmtd = this->priv; info = nmtd->info; - if (chip != -1 && allow_clk_stop(info)) + if (chip != -1 && allow_clk_stop(info) && + !test_and_set_bit(0, &info->clk_running)) clk_enable(info->clk); cur = readl(info->sel_reg); @@ -356,7 +361,8 @@ static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip) writel(cur, info->sel_reg); - if (chip == -1 && allow_clk_stop(info)) + if (chip == -1 && allow_clk_stop(info) && + test_and_clear_bit(0, &info->clk_running)) clk_disable(info->clk); } -- 1.5.6.5
next reply other threads:[~2010-03-30 8:24 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-03-30 8:22 Christian Pellegrin [this message] 2010-03-30 8:22 ` [PATCH v2.6.34-rc2] s3c: Fix CONFIG_MTD_NAND_S3C2410_CLKSTOP Christian Pellegrin 2010-05-04 6:57 ` Ben Dooks 2010-05-04 6:57 ` Ben Dooks 2010-05-04 7:13 ` christian pellegrin 2010-05-04 7:13 ` christian pellegrin 2010-05-06 5:53 ` Ben Dooks 2010-05-06 5:53 ` Ben Dooks
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=1269937323-7541-1-git-send-email-chripell@fsfe.org \ --to=chripell@fsfe.org \ --cc=ben-linux@fluff.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-samsung-soc@vger.kernel.org \ /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: linkBe 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.