From: Haavard Skinnemoen Date: Wed, 17 Dec 2008 15:53:07 +0000 (+0100) Subject: Merge branch 'fixes' into cleanups X-Git-Tag: v2009.06-rc1~145^2~1^2~4^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cb5473205206c7f14cbb1e747f28ec75b48826e2;p=u-boot Merge branch 'fixes' into cleanups Conflicts: board/atmel/atngw100/atngw100.c board/atmel/atstk1000/atstk1000.c cpu/at32ap/at32ap700x/gpio.c include/asm-avr32/arch-at32ap700x/clk.h include/configs/atngw100.h include/configs/atstk1002.h include/configs/atstk1003.h include/configs/atstk1004.h include/configs/atstk1006.h include/configs/favr-32-ezkit.h include/configs/hammerhead.h include/configs/mimc200.h --- cb5473205206c7f14cbb1e747f28ec75b48826e2 diff --cc board/atmel/atngw100/atngw100.c index 480d5255fd,fa1a2aa7c1..004d8daa90 --- a/board/atmel/atngw100/atngw100.c +++ b/board/atmel/atngw100/atngw100.c @@@ -26,7 -26,7 +26,8 @@@ #include #include #include +#include + #include DECLARE_GLOBAL_DATA_PTR; @@@ -92,11 -92,8 +93,9 @@@ int board_early_init_r(void { gd->bd->bi_phy_id[0] = 0x01; gd->bd->bi_phy_id[1] = 0x03; + return 0; } - extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr); - #ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bi) { diff --cc board/atmel/atstk1000/atstk1000.c index 7be39931e5,94523b5a3b..c36cb5717b --- a/board/atmel/atstk1000/atstk1000.c +++ b/board/atmel/atstk1000/atstk1000.c @@@ -24,8 -24,9 +24,9 @@@ #include #include #include -#include #include +#include + #include DECLARE_GLOBAL_DATA_PTR; @@@ -114,11 -115,8 +115,9 @@@ int board_early_init_r(void { gd->bd->bi_phy_id[0] = 0x10; gd->bd->bi_phy_id[1] = 0x11; + return 0; } - extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr); - #ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bi) { diff --cc board/miromico/hammerhead/hammerhead.c index 7fd0781254,d3875f449d..8b3e22cd9e --- a/board/miromico/hammerhead/hammerhead.c +++ b/board/miromico/hammerhead/hammerhead.c @@@ -22,7 -22,10 +22,8 @@@ * MA 02111-1307 USA */ -#include "../cpu/at32ap/at32ap700x/sm.h" - #include + #include #include #include diff --cc include/asm-avr32/arch-at32ap700x/clk.h index 21545a3c18,7817572270..d83e93b74f --- a/include/asm-avr32/arch-at32ap700x/clk.h +++ b/include/asm-avr32/arch-at32ap700x/clk.h @@@ -23,13 -23,11 +23,14 @@@ #define __ASM_AVR32_ARCH_CLK_H__ #include +#include #ifdef CONFIG_PLL - #define PLL0_RATE ((CFG_OSC0_HZ / CFG_PLL0_DIV) * CFG_PLL0_MUL) -#define MAIN_CLK_RATE ((CONFIG_SYS_OSC0_HZ / CONFIG_SYS_PLL0_DIV) * CONFIG_SYS_PLL0_MUL) ++#define PLL0_RATE ((CONFIG_SYS_OSC0_HZ / CONFIG_SYS_PLL0_DIV) \ ++ * CONFIG_SYS_PLL0_MUL) +#define MAIN_CLK_RATE PLL0_RATE #else - #define MAIN_CLK_RATE (CFG_OSC0_HZ) -#define MAIN_CLK_RATE (CONFIG_SYS_OSC0_HZ) ++#define MAIN_CLK_RATE (CONFIG_SYS_OSC0_HZ) #endif static inline unsigned long get_cpu_clk_rate(void) @@@ -84,101 -82,9 +85,101 @@@ static inline unsigned long get_spi_clk #endif extern void clk_init(void); -extern void gclk_init(void) __attribute__((weak)); /* Board code may need the SDRAM base clock as a compile-time constant */ - #define SDRAMC_BUS_HZ (MAIN_CLK_RATE >> CFG_CLKDIV_HSB) + #define SDRAMC_BUS_HZ (MAIN_CLK_RATE >> CONFIG_SYS_CLKDIV_HSB) +/* Generic clock control */ +enum gclk_parent { + GCLK_PARENT_OSC0 = 0, + GCLK_PARENT_OSC1 = 1, + GCLK_PARENT_PLL0 = 2, + GCLK_PARENT_PLL1 = 3, +}; + +/* Some generic clocks have specific roles */ +#define GCLK_DAC_SAMPLE_CLK 6 +#define GCLK_LCDC_PIXCLK 7 + +extern unsigned long __gclk_set_rate(unsigned int id, enum gclk_parent parent, + unsigned long rate, unsigned long parent_rate); + +/** + * gclk_set_rate - configure and enable a generic clock + * @id: Which GCLK[id] to enable + * @parent: Parent clock feeding the GCLK + * @rate: Target rate of the GCLK in Hz + * + * Returns the actual GCLK rate in Hz, after rounding to the nearest + * supported rate. + * + * All three parameters are usually constant, hence the inline. + */ +static inline unsigned long gclk_set_rate(unsigned int id, + enum gclk_parent parent, unsigned long rate) +{ + unsigned long parent_rate; + + if (id > 7) + return 0; + + switch (parent) { + case GCLK_PARENT_OSC0: - parent_rate = CFG_OSC0_HZ; ++ parent_rate = CONFIG_SYS_OSC0_HZ; + break; - #ifdef CFG_OSC1_HZ ++#ifdef CONFIG_SYS_OSC1_HZ + case GCLK_PARENT_OSC1: - parent_rate = CFG_OSC1_HZ; ++ parent_rate = CONFIG_SYS_OSC1_HZ; + break; +#endif +#ifdef PLL0_RATE + case GCLK_PARENT_PLL0: + parent_rate = PLL0_RATE; + break; +#endif +#ifdef PLL1_RATE + case GCLK_PARENT_PLL1: + parent_rate = PLL1_RATE; + break; +#endif + default: + parent_rate = 0; + break; + } + + return __gclk_set_rate(id, parent, rate, parent_rate); +} + +/** + * gclk_enable_output - enable output on a GCLK pin + * @id: Which GCLK[id] pin to enable + * @drive_strength: Drive strength of external GCLK pin, if applicable + */ +static inline void gclk_enable_output(unsigned int id, + unsigned long drive_strength) +{ + switch (id) { + case 0: + portmux_select_peripheral(PORTMUX_PORT_A, 1 << 30, + PORTMUX_FUNC_A, drive_strength); + break; + case 1: + portmux_select_peripheral(PORTMUX_PORT_A, 1 << 31, + PORTMUX_FUNC_A, drive_strength); + break; + case 2: + portmux_select_peripheral(PORTMUX_PORT_B, 1 << 19, + PORTMUX_FUNC_A, drive_strength); + break; + case 3: + portmux_select_peripheral(PORTMUX_PORT_B, 1 << 29, + PORTMUX_FUNC_A, drive_strength); + break; + case 4: + portmux_select_peripheral(PORTMUX_PORT_B, 1 << 30, + PORTMUX_FUNC_A, drive_strength); + break; + } +} + #endif /* __ASM_AVR32_ARCH_CLK_H__ */ diff --cc include/configs/atngw100.h index 323b096ab1,9e97624765..c998952fbf --- a/include/configs/atngw100.h +++ b/include/configs/atngw100.h @@@ -124,9 -124,9 +124,9 @@@ #define CONFIG_ATMEL_USART 1 #define CONFIG_MACB 1 -#define CONFIG_PIO2 1 +#define CONFIG_PORTMUX_PIO 1 - #define CFG_NR_PIOS 5 - #define CFG_HSDRAMC 1 + #define CONFIG_SYS_NR_PIOS 5 + #define CONFIG_SYS_HSDRAMC 1 #define CONFIG_MMC 1 #define CONFIG_ATMEL_MCI 1 #define CONFIG_ATMEL_SPI 1 diff --cc include/configs/atstk1002.h index 85cedb2fb2,2870adef0f..2284277da2 --- a/include/configs/atstk1002.h +++ b/include/configs/atstk1002.h @@@ -149,9 -149,9 +149,9 @@@ #define CONFIG_ATMEL_USART 1 #define CONFIG_MACB 1 -#define CONFIG_PIO2 1 +#define CONFIG_PORTMUX_PIO 1 - #define CFG_NR_PIOS 5 - #define CFG_HSDRAMC 1 + #define CONFIG_SYS_NR_PIOS 5 + #define CONFIG_SYS_HSDRAMC 1 #define CONFIG_MMC 1 #define CONFIG_ATMEL_MCI 1 diff --cc include/configs/atstk1003.h index 9aa0692c0d,1e80dc856e..2ef255274f --- a/include/configs/atstk1003.h +++ b/include/configs/atstk1003.h @@@ -133,8 -133,8 +133,8 @@@ #undef CONFIG_CMD_XIMG #define CONFIG_ATMEL_USART 1 -#define CONFIG_PIO2 1 +#define CONFIG_PORTMUX_PIO 1 - #define CFG_HSDRAMC 1 + #define CONFIG_SYS_HSDRAMC 1 #define CONFIG_MMC 1 #define CONFIG_ATMEL_MCI 1 diff --cc include/configs/atstk1004.h index d8ce339c2a,0e4f4103b2..195be82095 --- a/include/configs/atstk1004.h +++ b/include/configs/atstk1004.h @@@ -133,8 -133,8 +133,8 @@@ #undef CONFIG_CMD_XIMG #define CONFIG_ATMEL_USART 1 -#define CONFIG_PIO2 1 +#define CONFIG_PORTMUX_PIO 1 - #define CFG_HSDRAMC 1 + #define CONFIG_SYS_HSDRAMC 1 #define CONFIG_MMC 1 #define CONFIG_ATMEL_MCI 1 diff --cc include/configs/atstk1006.h index d4b2f12aa8,c53459664b..8cfa31269b --- a/include/configs/atstk1006.h +++ b/include/configs/atstk1006.h @@@ -149,9 -149,9 +149,9 @@@ #define CONFIG_ATMEL_USART 1 #define CONFIG_MACB 1 -#define CONFIG_PIO2 1 +#define CONFIG_PORTMUX_PIO 1 - #define CFG_NR_PIOS 5 - #define CFG_HSDRAMC 1 + #define CONFIG_SYS_NR_PIOS 5 + #define CONFIG_SYS_HSDRAMC 1 #define CONFIG_MMC 1 #define CONFIG_ATMEL_MCI 1 diff --cc include/configs/favr-32-ezkit.h index 3c9420cf91,3cef4196df..21802df1d2 --- a/include/configs/favr-32-ezkit.h +++ b/include/configs/favr-32-ezkit.h @@@ -146,9 -146,9 +146,9 @@@ #define CONFIG_ATMEL_USART 1 #define CONFIG_MACB 1 -#define CONFIG_PIO2 1 +#define CONFIG_PORTMUX_PIO 1 - #define CFG_NR_PIOS 5 - #define CFG_HSDRAMC 1 + #define CONFIG_SYS_NR_PIOS 5 + #define CONFIG_SYS_HSDRAMC 1 #define CONFIG_MMC 1 #define CONFIG_ATMEL_MCI 1 diff --cc include/configs/hammerhead.h index fca4111867,317a3d7dd7..0c70af5742 --- a/include/configs/hammerhead.h +++ b/include/configs/hammerhead.h @@@ -117,9 -117,9 +117,9 @@@ #define CONFIG_ATMEL_USART 1 #define CONFIG_MACB 1 -#define CONFIG_PIO2 1 +#define CONFIG_PORTMUX_PIO 1 - #define CFG_NR_PIOS 5 - #define CFG_HSDRAMC 1 + #define CONFIG_SYS_NR_PIOS 5 + #define CONFIG_SYS_HSDRAMC 1 #define CONFIG_MMC 1 #define CONFIG_ATMEL_MCI 1 diff --cc include/configs/mimc200.h index 0506b93c75,312fdc9e4d..2eb9ebc290 --- a/include/configs/mimc200.h +++ b/include/configs/mimc200.h @@@ -121,9 -121,9 +121,9 @@@ #define CONFIG_ATMEL_USART 1 #define CONFIG_MACB 1 -#define CONFIG_PIO2 1 +#define CONFIG_PORTMUX_PIO 1 - #define CFG_NR_PIOS 5 - #define CFG_HSDRAMC 1 + #define CONFIG_SYS_NR_PIOS 5 + #define CONFIG_SYS_HSDRAMC 1 #define CONFIG_MMC 1 #define CONFIG_ATMEL_MCI 1 diff --cc lib_avr32/board.c index 4ed6c96630,2a98bd41f6..959375a48f --- a/lib_avr32/board.c +++ b/lib_avr32/board.c @@@ -281,10 -273,8 +282,10 @@@ void board_init_r(gd_t *new_gd, ulong d bd = gd->bd; gd->flags |= GD_FLG_RELOC; - gd->reloc_off = dest_addr - CFG_MONITOR_BASE; + gd->reloc_off = dest_addr - CONFIG_SYS_MONITOR_BASE; + board_early_init_r(); + monitor_flash_len = _edata - _text; /*