public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Dong Aisheng <aisheng.dong@freescale.com>
To: "Lothar Waßmann" <LW@KARO-electronics.de>
Cc: "dedekind1@gmail.com" <dedekind1@gmail.com>,
	Huang Shijie <shijie8@gmail.com>,
	Huang Shijie-B32955 <B32955@freescale.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Shawn Guo <shawn.guo@linaro.org>,
	Dong Aisheng-B29396 <B29396@freescale.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/3] mtd: gpmi: change the code for clocks
Date: Fri, 29 Jun 2012 17:54:33 +0800	[thread overview]
Message-ID: <20120629095433.GO5844@shlinux2.ap.freescale.net> (raw)
In-Reply-To: <20461.30991.63507.369439@ipc1.ka-ro>

On Fri, Jun 29, 2012 at 05:44:47PM +0800, Lothar Waßmann wrote:
> Hi,
> 
> Dong Aisheng writes:
> > On Fri, Jun 29, 2012 at 05:29:26PM +0800, Lothar Waßmann wrote:
> > > Hi,
> > > 
> > > Dong Aisheng writes:
> > > > On Fri, Jun 29, 2012 at 10:06:52AM +0800, Shawn Guo wrote:
> > > > > On Thu, Jun 28, 2012 at 11:52:05PM -0400, Huang Shijie wrote:
> > > > > > From: Huang Shijie <b32955@freescale.com>
> > > > > > 
> > > > > > The gpmi nand driver may needs several clocks(MX6Q needs five clocks).
> > > > > > 
> > > > > > In the old clock framework, all these clocks are chained together,
> > > > > > all you need is to manipulate the first clock.
> > > > > > 
> > > > > > But the kernel uses the common clk framework now, which forces us to
> > > > > > get the clocks one by one. When we use them, we have to enable them
> > > > > > one by one too.
> > > > > > 
> > > [...]
> > > > > > +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.
> > > > > 
> > > > Will mx28 fail if doing like that?
> > > > clk_get will fail if no clock found.
> > > > struct clk *clk_get_sys(const char *dev_id, const char *con_id)
> > > > {
> > > >         struct clk_lookup *cl;
> > > > 
> > > >         mutex_lock(&clocks_mutex);
> > > >         cl = clk_find(dev_id, con_id);
> > > >         if (cl && !__clk_get(cl->clk))
> > > >                 cl = NULL;
> > > >         mutex_unlock(&clocks_mutex);
> > > > 
> > > >         return cl ? cl->clk : ERR_PTR(-ENOENT);
> > > > }
> > > > EXPORT_SYMBOL(clk_get_sys);
> > > > 
> > > > Furthermore, find unnecessary clock for mx28 seems not a good choice.
> > > > Probably a better way is to define each SoC required clocks and get them
> > > > respectively. It's explicit and clear.
> > > > 
> > > No, that's silly. You would have to change the driver for each
> > > new platform that the driver can support.
> > > 
> > If the new platform is fully compatible with exist platforms, then no.
> > If need more clocks, then in either way, we have to add support in driver.
> > 
> Even if it had fewer clocks you would have to change the driver!
> 
Yes.
For your case, you need create some dummy clock, right?
If yes, i would intend to explictly to define it for a new type
of IP.

Regards
Dong Aisheng

  reply	other threads:[~2012-06-29  9:54 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
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 [this message]
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=20120629095433.GO5844@shlinux2.ap.freescale.net \
    --to=aisheng.dong@freescale.com \
    --cc=B29396@freescale.com \
    --cc=B32955@freescale.com \
    --cc=LW@KARO-electronics.de \
    --cc=dedekind1@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=shawn.guo@linaro.org \
    --cc=shijie8@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