on duplicating device tree clk constants

Lucas Stach dev at lynxeye.de
Wed Mar 26 05:03:00 EDT 2014


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





More information about the barebox mailing list