Merge branch 'fixes' into cleanups
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Wed, 17 Dec 2008 15:53:07 +0000 (16:53 +0100)
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Wed, 17 Dec 2008 15:53:07 +0000 (16:53 +0100)
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

17 files changed:
1  2 
board/atmel/atngw100/atngw100.c
board/atmel/atstk1000/atstk1000.c
board/earthlcd/favr-32-ezkit/favr-32-ezkit.c
board/mimc/mimc200/mimc200.c
board/miromico/hammerhead/hammerhead.c
cpu/at32ap/at32ap700x/clk.c
cpu/at32ap/cpu.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
lib_avr32/board.c

@@@ -26,7 -26,7 +26,8 @@@
  #include <asm/arch/clk.h>
  #include <asm/arch/gpio.h>
  #include <asm/arch/hmatrix.h>
 +#include <asm/arch/portmux.h>
+ #include <netdev.h>
  
  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)
  {
@@@ -24,8 -24,9 +24,9 @@@
  #include <asm/io.h>
  #include <asm/sdram.h>
  #include <asm/arch/clk.h>
 -#include <asm/arch/gpio.h>
  #include <asm/arch/hmatrix.h>
 +#include <asm/arch/portmux.h>
+ #include <netdev.h>
  
  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)
  {
Simple merge
   * MA 02111-1307 USA
   */
  
 -#include "../cpu/at32ap/at32ap700x/sm.h"
 -
  #include <common.h>
+ #include <netdev.h>
  
  #include <asm/io.h>
  #include <asm/sdram.h>
Simple merge
Simple merge
  #define __ASM_AVR32_ARCH_CLK_H__
  
  #include <asm/arch/chip-features.h>
 +#include <asm/arch/portmux.h>
  
  #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)
  
-               parent_rate = CFG_OSC0_HZ;
 +/* 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:
- #ifdef CFG_OSC1_HZ
++              parent_rate = CONFIG_SYS_OSC0_HZ;
 +              break;
-               parent_rate = CFG_OSC1_HZ;
++#ifdef CONFIG_SYS_OSC1_HZ
 +      case GCLK_PARENT_OSC1:
++              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__ */
  
  #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
  
  #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
  
  #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
  
  #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
  
  
  #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_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_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_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
  
@@@ -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;
  
        /*