mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <dev@lynxeye.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: on duplicating device tree clk constants
Date: Wed, 26 Mar 2014 10:03:00 +0100	[thread overview]
Message-ID: <1395824580.2079.3.camel@tellur> (raw)
In-Reply-To: <20140326114316.26869b3b6dd537859df09a20@gmail.com>

Am Mittwoch, den 26.03.2014, 11:43 +0400 schrieb Antony Pavlov:
> Hi!
> 
> Just now I'm working on improvement of device tree support in barebox-mips.
> 
> I have examined some existing ARM device trees. I have a clock-related question.
> I'll use tegra20 device tree as an example.
> 
> We have the include/dt-bindings/clock/tegra20-car.h file with clock numbers defines:
> 
> Here is a small part of the file:
> 
>   #define TEGRA20_CLK_CPU 0
>   /* 1 */
>   /* 2 */
>   #define TEGRA20_CLK_AC97 3
>   #define TEGRA20_CLK_RTC 4
>   #define TEGRA20_CLK_TIMER 5
>   #define TEGRA20_CLK_UARTA 6
> 
> At the other hand we have enum tegra20_clks definition in the drivers/clk/tegra/clk-tegra20.c file:
> 
>   enum tegra20_clks {
>         cpu, ac97 = 3, rtc, timer, uarta, uartb, gpio, sdmmc2, i2s1 = 11, i2c1,
>         ndflash, sdmmc1, sdmmc4, twc, pwm, i2s2, epp, gr2d = 21, usbd, isp,
> 
> I see that the constants are the same, but they have differrent names.
> 
> Can we drop duplicated definitions?
> 
> What device tree clock design pattern I have to use for new code?
> 
Right, the enum is still in the clock driver, as this was written before
the DT binding includes were there. I have some some additions to the
clock driver in the pipeline and will remove the enum in the course of
this.

So please if you write a new clock driver just use the DT includes. It
makes maintenance a lot easier.

Regards,
Lucas



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2014-03-26  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26  7:43 Antony Pavlov
2014-03-26  9:03 ` Lucas Stach [this message]

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=1395824580.2079.3.camel@tellur \
    --to=dev@lynxeye.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@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