From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/7] ARM: imx5: adopt generic_chip irq_domain support for tzic
Date: Wed, 15 Feb 2012 20:59:06 -0800 [thread overview]
Message-ID: <20120216045905.GI30946@r65073-Latitude-D630> (raw)
In-Reply-To: <4F3C7B45.1080907@gmail.com>
On Wed, Feb 15, 2012 at 09:43:01PM -0600, Rob Herring wrote:
...
> > +static inline void __iomem *get_gpt_base_dt(struct device_node *np);
> > +static inline int get_gpt_irq_dt(struct device_node *np);
> > +
> > int __init mx51_clocks_init(unsigned long ckil, unsigned long osc,
> > unsigned long ckih1, unsigned long ckih2)
> > {
> > int i;
> > + int gpt_irq = MX51_INT_GPT;
> > + void __iomem *gpt_base = MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR);
> > + struct device_node *np = of_find_compatible_node(NULL, NULL, "fsl,gpt");
> >
> > external_low_reference = ckil;
> > external_high_reference = ckih1;
> > @@ -1592,8 +1600,12 @@ int __init mx51_clocks_init(unsigned long ckil, unsigned long osc,
> > clk_set_rate(&esdhc2_clk, 166250000);
> >
> > /* System timer */
> > - mxc_timer_init(&gpt_clk, MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR),
> > - MX51_INT_GPT);
> > + if (np) {
> > + gpt_base = get_gpt_base_dt(np);
> > + gpt_irq = get_gpt_irq_dt(np);
> > + }
> > + WARN_ON(!gpt_base);
> > + mxc_timer_init(&gpt_clk, gpt_base, gpt_irq);
> > return 0;
> > }
> >
> > @@ -1601,6 +1613,9 @@ int __init mx53_clocks_init(unsigned long ckil, unsigned long osc,
> > unsigned long ckih1, unsigned long ckih2)
> > {
> > int i;
> > + int gpt_irq = MX53_INT_GPT;
> > + void __iomem *gpt_base = MX53_IO_ADDRESS(MX53_GPT1_BASE_ADDR);
> > + struct device_node *np = of_find_compatible_node(NULL, NULL, "fsl,gpt");
> >
> > external_low_reference = ckil;
> > external_high_reference = ckih1;
> > @@ -1629,8 +1644,12 @@ int __init mx53_clocks_init(unsigned long ckil, unsigned long osc,
> > clk_set_rate(&esdhc3_mx53_clk, 200000000);
> >
> > /* System timer */
> > - mxc_timer_init(&gpt_clk, MX53_IO_ADDRESS(MX53_GPT1_BASE_ADDR),
> > - MX53_INT_GPT);
> > + if (np) {
> > + gpt_base = get_gpt_base_dt(np);
> > + gpt_irq = get_gpt_irq_dt(np);
> > + }
> > + WARN_ON(!gpt_base);
> > + mxc_timer_init(&gpt_clk, gpt_base, gpt_irq);
> > return 0;
> > }
> >
> > @@ -1672,4 +1691,24 @@ int __init mx53_clocks_init_dt(void)
> > clk_get_freq_dt(&ckil, &osc, &ckih1, &ckih2);
> > return mx53_clocks_init(ckil, osc, ckih1, ckih2);
> > }
> > +
> > +static inline void __iomem *get_gpt_base_dt(struct device_node *np)
> > +{
> > + return of_iomap(np, 0);
> > +}
> > +
> > +static inline int get_gpt_irq_dt(struct device_node *np)
> > +{
> > + return irq_of_parse_and_map(np, 0);
> > +}
> > +#else
> > +static inline void __iomem *get_gpt_base_dt(struct device_node *np)
> > +{
> > + return NULL;
> > +}
> > +
> > +static inline int get_gpt_irq_dt(struct device_node *np)
> > +{
> > + return -ENODEV;
> > +}
>
> Reorder so you don't need forward declarations.
>
I'm trying to save one more occurrence of "#ifdef CONFIG_OF", or I
to move around the whole block wrapped by #ifdef, which will make
unnecessary diffstat churn.
I hope we can stop this nasty #ifdef at some point by select CONFIG_OF
for the imx architecture.
> Once again, I think this is too intermixed with DT and non-DT, but you
> are getting the data from DT so I guess it's fine for now.
>
I guess that's the situation we have to live with until the non-DT
support gets completely removed.
--
Regards,
Shawn
next prev parent reply other threads:[~2012-02-16 4:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-15 18:47 [PATCH v2 0/7] irq_domain for imx tzic and gpio Shawn Guo
2012-02-15 18:47 ` [PATCH v2 1/7] dt: add empty of_find_compatible_node function Shawn Guo
2012-02-15 20:10 ` Grant Likely
2012-02-15 18:47 ` [PATCH v2 2/7] ARM: imx5: adopt generic_chip irq_domain support for tzic Shawn Guo
2012-02-16 3:43 ` Rob Herring
2012-02-16 4:59 ` Shawn Guo [this message]
2012-02-15 18:47 ` [PATCH v2 3/7] ARM: imx: eliminate macro IMX_GPIO_TO_IRQ() Shawn Guo
2012-02-15 18:47 ` [PATCH v2 4/7] ARM: imx: eliminate macro IOMUX_TO_IRQ() Shawn Guo
2012-02-15 18:47 ` [PATCH v2 5/7] ARM: imx: eliminate macro IRQ_GPIOx() Shawn Guo
2012-02-15 23:29 ` Fabio Estevam
2012-02-16 0:15 ` Shawn Guo
2012-02-15 18:47 ` [PATCH v2 6/7] gpio/mxc: adopt irq_domain for gpio interrupt support Shawn Guo
2012-02-15 18:47 ` [PATCH v2 7/7] ARM: imx: remove macro MXC_GPIO_IRQ_START Shawn Guo
2012-02-15 20:16 ` Grant Likely
2012-02-15 21:56 ` Shawn Guo
2012-02-16 7:47 ` [PATCH v2 0/7] irq_domain for imx tzic and gpio Sascha Hauer
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=20120216045905.GI30946@r65073-Latitude-D630 \
--to=shawn.guo@linaro.org \
--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