From: b32955@freescale.com (Huang Shijie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] mtd: gpmi: change the code for clocks
Date: Fri, 29 Jun 2012 13:52:40 +0800 [thread overview]
Message-ID: <4FED42A8.40301@freescale.com> (raw)
In-Reply-To: <20120629020650.GB28932@S2101-09.ap.freescale.net>
? 2012?06?29? 10:06, Shawn Guo ??:
>> gpmi_regs + HW_GPMI_TIMING1);
>> >
>> > /* Get the timing information we need. */
>> > - nfc->clock_frequency_in_hz = clk_get_rate(r->clock);
>> > + nfc->clock_frequency_in_hz = clk_get_rate(r->clock[0]);
>> > clock_period_in_ns = 1000000000 / nfc->clock_frequency_in_hz;
>> >
>> > gpmi_nfc_compute_hardware_timing(this,&hw);
>> > @@ -784,8 +812,7 @@ err_out:
>> >
>> > void gpmi_end(struct gpmi_nand_data *this)
>> > {
>> > - struct resources *r =&this->resources;
>> > - clk_disable_unprepare(r->clock);
>> > + gpmi_disable_clk(this);
>> > }
>> >
>> > /* Clears a BCH interrupt. */
>> > diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
>> > index 941cfb7..edda3b1 100644
>> > --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
>> > +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
>> > @@ -464,9 +464,59 @@ acquire_err:
>> > return -EINVAL;
>> > }
>> >
>> > +static void gpmi_put_clks(struct gpmi_nand_data *this)
>> > +{
>> > + struct resources *r =&this->resources;
>> > + struct clk *clk;
>> > + int i;
>> > +
>> > + for (i = 0; i< GPMI_CLK_MAX; i++) {
>> > + clk = r->clock[i];
>> > + if (clk) {
>> > + clk_put(clk);
>> > + r->clock[i] = NULL;
>> > + }
>> > + }
>> > +}
>> > +
>> > +static char *extra_clks_for_mx6q[] = {
>> > + "gpmi_apb", "gpmi_bch", "gpmi_bch_apb", "per1_bch",
>> > +};
>> > +
>> > +static int __devinit gpmi_get_clks(struct gpmi_nand_data *this)
>> > +{
>> > + struct resources *r =&this->resources;
>> > + char **extra_clks = NULL;
>> > + struct clk *clk;
>> > + int i;
>> > +
>> > + r->clock[0] = clk_get(&this->pdev->dev, NULL);
>> > + if (IS_ERR(r->clock[0]))
>> > + goto err_clock;
>> > +
>> > + /* Get extra clocks */
>> > + if (GPMI_IS_MX6Q(this))
>> > + extra_clks = extra_clks_for_mx6q;
> We probably do not need this tweaking. We can have the driver always
> take all those 5 clocks, and I think the current imx28 clock driver
> can just work with it, because the gpmi-nand clkdev lookup has NULL
> con_id and all those 5 clocks can match the same one on imx28.
>
I think your method makes the code hard to understand.
My code is more clear in logic.
thanks
Huang Shijie
next prev parent reply other threads:[~2012-06-29 5:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-29 3:52 [PATCH 1/3] ARM: imx6q: add clocks for gpmi-nand Huang Shijie
2012-06-29 1:50 ` Shawn Guo
2012-06-29 2:29 ` Dong Aisheng
2012-06-29 2:57 ` Huang Shijie
2012-06-29 3:03 ` Shawn Guo
2012-06-29 3:52 ` [PATCH 2/3] ARM: imx6q: add DT node for gpmi nand Huang Shijie
2012-06-29 3:10 ` Dong Aisheng
2012-06-29 3:24 ` Huang Shijie
2012-06-29 3:52 ` [PATCH 3/3] mtd: gpmi: change the code for clocks Huang Shijie
2012-06-29 2:06 ` Shawn Guo
2012-06-29 2:32 ` Huang Shijie
2012-06-29 5:52 ` Huang Shijie [this message]
2012-06-29 6:33 ` Dong Aisheng
2012-06-29 9:29 ` Lothar Waßmann
2012-06-29 9:34 ` Dong Aisheng
2012-06-29 9:44 ` Lothar Waßmann
2012-06-29 9:54 ` Dong Aisheng
2012-06-29 11:13 ` Shawn Guo
2012-06-29 12:14 ` Dong Aisheng
2012-06-29 12:41 ` Shawn Guo
2012-06-29 12:41 ` Dong Aisheng
2012-06-29 12:53 ` Shawn Guo
2012-06-29 10:02 ` Huang Shijie
2012-06-29 11:22 ` Shawn Guo
2012-06-30 17:52 ` Mark Brown
2012-06-29 3:35 ` Subodh Nijsure
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=4FED42A8.40301@freescale.com \
--to=b32955@freescale.com \
--cc=linux-arm-kernel@lists.infradead.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: 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).