mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* on duplicating device tree clk constants
@ 2014-03-26  7:43 Antony Pavlov
  2014-03-26  9:03 ` Lucas Stach
  0 siblings, 1 reply; 2+ messages in thread
From: Antony Pavlov @ 2014-03-26  7:43 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

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?

-- 
Best regards,
  Antony Pavlov

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: on duplicating device tree clk constants
  2014-03-26  7:43 on duplicating device tree clk constants Antony Pavlov
@ 2014-03-26  9:03 ` Lucas Stach
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas Stach @ 2014-03-26  9:03 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-26  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26  7:43 on duplicating device tree clk constants Antony Pavlov
2014-03-26  9:03 ` Lucas Stach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox