All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: eric.y.miao@gmail.com, devicetree-discuss@lists.ozlabs.org,
	Haojian Zhuang <haojian.zhuang@marvell.com>,
	haojian.zhuang@gmail.com, linux-arm-kernel@lists.infradead.org,
	alan@linux.intel.com
Subject: Re: [PATCH v2 4/7] tty: serial: support device tree in pxa
Date: Fri, 29 Jul 2011 17:49:22 +0100	[thread overview]
Message-ID: <20110729164922.GA30298@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20110729164539.GM11164@ponder.secretlab.ca>

On Fri, Jul 29, 2011 at 10:45:39AM -0600, Grant Likely wrote:
> On Thu, Jul 28, 2011 at 02:41:30PM +0800, Haojian Zhuang wrote:
> > +#ifdef CONFIG_OF
> > +	for (i = 0; i < PXA_SERIAL_NR; i++) {
> > +		if (serial_pxa_ports[i] == NULL)
> > +			break;
> > +	}
> > +	if (i >= PXA_SERIAL_NR) {
> > +		pr_warn("can't find pxa serial port\n");
> > +		return -ENODEV;
> > +	}
> > +
> > +	if (of_property_read_u32(np, "clock-frequency", &clk)) {
> > +		pr_warn("no clock-frequency property set\n");
> > +		return -ENODEV;
> > +	}
> > +	if (of_property_read_u32(np, "current-speed", &spd) == 0)
> > +		sport->port.custom_divisor = clk / (16 * spd);
> > +
> > +	sprintf(name, "pxa2xx-uart.%d", i);
> > +	sport->clk = clk_get_sys(name, NULL);
> > +	if (IS_ERR(sport->clk)) {
> > +		ret = PTR_ERR(sport->clk);
> > +		goto err_free;
> > +	}
> > +	sport->port.uartclk = clk;
> > +#else
> > +	i = dev->id;
> >  	sport->clk = clk_get(&dev->dev, NULL);
> >  	if (IS_ERR(sport->clk)) {
> >  		ret = PTR_ERR(sport->clk);
> >  		goto err_free;
> >  	}
> > +	sport->port.uartclk = clk_get_rate(sport->clk);
> > +#endif
> 
> This means a kernel build can either support DT or non-DT, but not
> both.  DT & non-DT booting are full supported with the same kernel
> image, so don't do it this way.
> 
> Instead, check for the presence of an of_node.  If it is there, do the
> DT parsing.  If now, still support the old method.

Oh ffs, why is this DT stuff causing all the clk stuff to have to change.
And specifically why is stuff converting to use clk_get_sys().

clk_get_sys() is there to allow system devices to get their clocks.
It's not for general drivers to use.

Please, stop this madness.

WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/7] tty: serial: support device tree in pxa
Date: Fri, 29 Jul 2011 17:49:22 +0100	[thread overview]
Message-ID: <20110729164922.GA30298@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20110729164539.GM11164@ponder.secretlab.ca>

On Fri, Jul 29, 2011 at 10:45:39AM -0600, Grant Likely wrote:
> On Thu, Jul 28, 2011 at 02:41:30PM +0800, Haojian Zhuang wrote:
> > +#ifdef CONFIG_OF
> > +	for (i = 0; i < PXA_SERIAL_NR; i++) {
> > +		if (serial_pxa_ports[i] == NULL)
> > +			break;
> > +	}
> > +	if (i >= PXA_SERIAL_NR) {
> > +		pr_warn("can't find pxa serial port\n");
> > +		return -ENODEV;
> > +	}
> > +
> > +	if (of_property_read_u32(np, "clock-frequency", &clk)) {
> > +		pr_warn("no clock-frequency property set\n");
> > +		return -ENODEV;
> > +	}
> > +	if (of_property_read_u32(np, "current-speed", &spd) == 0)
> > +		sport->port.custom_divisor = clk / (16 * spd);
> > +
> > +	sprintf(name, "pxa2xx-uart.%d", i);
> > +	sport->clk = clk_get_sys(name, NULL);
> > +	if (IS_ERR(sport->clk)) {
> > +		ret = PTR_ERR(sport->clk);
> > +		goto err_free;
> > +	}
> > +	sport->port.uartclk = clk;
> > +#else
> > +	i = dev->id;
> >  	sport->clk = clk_get(&dev->dev, NULL);
> >  	if (IS_ERR(sport->clk)) {
> >  		ret = PTR_ERR(sport->clk);
> >  		goto err_free;
> >  	}
> > +	sport->port.uartclk = clk_get_rate(sport->clk);
> > +#endif
> 
> This means a kernel build can either support DT or non-DT, but not
> both.  DT & non-DT booting are full supported with the same kernel
> image, so don't do it this way.
> 
> Instead, check for the presence of an of_node.  If it is there, do the
> DT parsing.  If now, still support the old method.

Oh ffs, why is this DT stuff causing all the clk stuff to have to change.
And specifically why is stuff converting to use clk_get_sys().

clk_get_sys() is there to allow system devices to get their clocks.
It's not for general drivers to use.

Please, stop this madness.

  reply	other threads:[~2011-07-29 16:49 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-28  6:41 [PATCH v2 00/07] enable devicetree on arch-mmp Haojian Zhuang
2011-07-28  6:41 ` Haojian Zhuang
     [not found] ` <1311835293-18125-1-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41   ` [PATCH v2 1/7] ARM: mmp: parse irq from DT Haojian Zhuang
2011-07-28  6:41     ` Haojian Zhuang
     [not found]     ` <1311835293-18125-2-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41       ` [PATCH v2 2/7] ARM: mmp: parse timer configuration " Haojian Zhuang
2011-07-28  6:41         ` Haojian Zhuang
     [not found]         ` <1311835293-18125-3-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41           ` [PATCH v2 3/7] ARM: mmp: support DT on both dkb and brownstone Haojian Zhuang
2011-07-28  6:41             ` Haojian Zhuang
     [not found]             ` <1311835293-18125-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41               ` [PATCH v2 4/7] tty: serial: support device tree in pxa Haojian Zhuang
2011-07-28  6:41                 ` Haojian Zhuang
     [not found]                 ` <1311835293-18125-5-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41                   ` [PATCH v2 5/7] tty: serial: check ops before registering console Haojian Zhuang
2011-07-28  6:41                     ` Haojian Zhuang
     [not found]                     ` <1311835293-18125-6-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41                       ` [PATCH v2 6/7] i2c: pxa: support i2c controller from DT Haojian Zhuang
2011-07-28  6:41                         ` Haojian Zhuang
     [not found]                         ` <1311835293-18125-7-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-28  6:41                           ` [PATCH v2 7/7] i2c: pxa: support to parse property Haojian Zhuang
2011-07-28  6:41                             ` Haojian Zhuang
2011-07-29 16:52                           ` [PATCH v2 6/7] i2c: pxa: support i2c controller from DT Grant Likely
2011-07-29 16:52                             ` Grant Likely
     [not found]                             ` <20110729165222.GN11164-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-29 16:55                               ` Russell King - ARM Linux
2011-07-29 16:55                                 ` Russell King - ARM Linux
2011-07-30 14:29                                 ` Mitch Bradley
2011-07-30 14:29                                   ` Mitch Bradley
     [not found]                                   ` <4E34155E.8010606-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2011-07-30 15:37                                     ` Russell King - ARM Linux
2011-07-30 15:37                                       ` Russell King - ARM Linux
     [not found]                                       ` <20110730153728.GA17570-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-07-31  0:38                                         ` Grant Likely
2011-07-31  0:38                                           ` Grant Likely
2011-07-29 16:45                   ` [PATCH v2 4/7] tty: serial: support device tree in pxa Grant Likely
2011-07-29 16:45                     ` Grant Likely
2011-07-29 16:49                     ` Russell King - ARM Linux [this message]
2011-07-29 16:49                       ` Russell King - ARM Linux
     [not found]                       ` <20110729164922.GA30298-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-07-29 16:53                         ` Grant Likely
2011-07-29 16:53                           ` Grant Likely
2011-08-01  2:50                       ` Haojian Zhuang
2011-08-01  2:50                         ` Haojian Zhuang
     [not found]                         ` <CAN1soZwYjQp5c=4f=CbqjrXFxzSURSv6i9QHMyjyPszs=kzh9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-01  8:27                           ` Russell King - ARM Linux
2011-08-01  8:27                             ` Russell King - ARM Linux
2011-07-29 16:42               ` [PATCH v2 3/7] ARM: mmp: support DT on both dkb and brownstone Grant Likely
2011-07-29 16:42                 ` Grant Likely
     [not found]                 ` <20110729164218.GL11164-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-08-01  2:48                   ` Haojian Zhuang
2011-08-01  2:48                     ` Haojian Zhuang
2011-07-29 16:40           ` [PATCH v2 2/7] ARM: mmp: parse timer configuration from DT Grant Likely
2011-07-29 16:40             ` Grant Likely
2011-07-29 16:36       ` [PATCH v2 1/7] ARM: mmp: parse irq " Grant Likely
2011-07-29 16:36         ` Grant Likely
2011-08-01  2:47         ` Haojian Zhuang
2011-08-01  2:47           ` Haojian Zhuang
     [not found]           ` <CAN1soZxX6EBRPvzV_00njioBn1NfiAbLBoD7EYc-wV-uQM_VoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-01 14:10             ` Grant Likely
2011-08-01 14:10               ` Grant Likely
     [not found]               ` <20110801141036.GA21627-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-08-01 14:42                 ` Haojian Zhuang
2011-08-01 14:42                   ` Haojian Zhuang
2011-08-01 14:43                   ` Grant Likely
2011-08-01 14:43                     ` Grant Likely
2011-08-01  8:26     ` Russell King - ARM Linux
2011-08-01  8:26       ` Russell King - ARM Linux

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=20110729164922.GA30298@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=alan@linux.intel.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=eric.y.miao@gmail.com \
    --cc=grant.likely@secretlab.ca \
    --cc=haojian.zhuang@gmail.com \
    --cc=haojian.zhuang@marvell.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 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.