From mboxrd@z Thu Jan 1 00:00:00 1970 From: Reinhard Meyer Date: Mon, 04 Oct 2010 09:44:28 +0200 Subject: [U-Boot] AT91 clock and timer cleanups (was: ARM relocation, probably trivial mistake - back to original problem) In-Reply-To: <4CA5F4CE.8050002@emk-elektronik.de> References: <4CA49746.2050301@emk-elektronik.de> <4CA4AEFF.3050101@denx.de> <20100930174308.070ECD2B48C@gemini.denx.de> <4CA570D3.9040406@denx.de> <4CA57468.6090702@free.fr> <4CA57762.3000201@denx.de> <4CA5821E.3070108@emk-elektronik.de> <4CA5873B.6040907@free.fr> <4CA590E6.6070701@emk-elektronik.de> <4CA59B89.6090207@denx.de> <4CA5BB7A.8050304@emk-elektronik.de> <20101001105506.A64D41539A0@gemini.denx.de> <4CA5BFEF.3090208@emk-elektronik.de> <20101001112125.4076E153A7E@gemini.denx.de> <4CA5C7DE.6010300@emk-elektronik.de> <20101001115908.A34411539A0@gemini.denx.de> <4CA5D26D.2090505@emk-elektronik.de> <20101001124946.7DE29153A7E@gemini.denx.de> <4CA5F4CE.8050002@emk-elektronik.de> Message-ID: <4CA985DC.4000208@emk-elektronik.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de I wrote: > Dear Wolfgang Denk, >> In message <4CA5D26D.2090505@emk-elektronik.de> you wrote: >>>> If this is really for all AT91 SoCs, then please feel free to >>>> introduce a common define (CONFIG_SYS_AT91 ?) and use that. Eventually >>>> you can clean up some other such #if's on the way. >>> That would have to be set either in each board.h file or in each at91*.h >>> file. >> Isn't there a central place? >> >>>> Probably there is a header file common to all AT91 SoCs when then can >>>> use a single such construct to #define the new variable so you don;t >>>> have to touch all the many board config files. >>> The only files I can see included in each instance are those of the kind >>> hardware.h, memory_map.h and similiar. The define does not really belong >>> in any of those. > > I tried arch-at91/hardware.h. Apparently it gets included after > global_data.h. Same would be true for all files included inside hardware.h. > Without reordering the includes (which I don't want to do) the remaining > place would be each board's config file. Since all AT91 boards are broken > anyway right now; adding it could be left to the respective maintainers :) > >> If no better place is found, we can even add this to (we do >> similar things there already for CONFIG_MPC866_FAMILY, CONFIG_MPC86x, >> CONFIG_MPC8272_FAMILY, CONFIG_TQM8xxM, CONFIG_TQM8xxL, etc. > > Into this chain? > #if defined(CONFIG_MPC852) || defined(CONFIG_MPC852T) || \ > defined(CONFIG_MPC859) || defined(CONFIG_MPC859T) || \ > defined(CONFIG_MPC859DSL) || \ > defined(CONFIG_MPC866) || defined(CONFIG_MPC866T) || \ > defined(CONFIG_MPC866P) > # define CONFIG_MPC866_FAMILY 1 > #elif defined(CONFIG_MPC870) \ > > Ugly, but possible :) > Just hoping that everytime a new AT91 comes out, it will not be forgotten to be added there ;) I have added required variables to global_data.h, it looks like this now: ... #ifdef CONFIG_FSL_ESDHC unsigned long sdhc_clk; #endif #if defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9XE) /* "static data" needed by at91's clock.c */ unsigned long cpu_clk_rate_hz; unsigned long main_clk_rate_hz; unsigned long mck_rate_hz; unsigned long plla_rate_hz; unsigned long pllb_rate_hz; unsigned long at91_pllb_usb_init; /* "static data" needed by at91's timer.c */ unsigned long timer_rate_hz; unsigned long tbl; unsigned long tbu; unsigned long long timer_reset_value; #endif #if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC) unsigned long relocaddr; /* Start address of U-Boot in RAM */ ... At the same time I cleaned up timer.c to really operate using 64 bit values like on powerpc (hence tbu, tbl) The Qs that remain now are: 1. currently I see about 8 CONFIG_AT91SAMxxx defines required (not only 2 like above). The method is still undecided how to handle this. Add "CONFIG_AT91SAM9_FAMILY" to "common.h"? Or put all 8 defined() into "global_data.h" (would give 4 lines there)? 2. How many patches would this change need, and who would collect them? It affects at worst 3 areas: common.h, arm/global_data.h, at91/clock.c+timer.c --- Or is it ok to put that into one patch and add it later to my atmel tree? Reinhard