Merge with /home/tur/git/u-boot#motionpro
authorWolfgang Denk <wd@denx.de>
Sun, 27 May 2007 23:11:11 +0000 (01:11 +0200)
committerWolfgang Denk <wd@denx.de>
Sun, 27 May 2007 23:11:11 +0000 (01:11 +0200)
1  2 
board/motionpro/motionpro.c
common/main.c
cpu/mpc5xxx/fec.c
include/configs/IceCube.h
include/configs/hmi1001.h
include/configs/mcc200.h

  
  #include <common.h>
  #include <mpc5xxx.h>
+ #include <miiphy.h>
  #if defined(CONFIG_OF_FLAT_TREE)
  #include <ft_build.h>
  #endif
  
+ #if defined(CONFIG_STATUS_LED)
+ #include <status_led.h>
+ #endif /* CONFIG_STATUS_LED */
  /* Kollmorgen DPR initialization data */
  struct init_elem {
        unsigned long addr;
@@@ -78,11 -82,27 +82,27 @@@ int board_early_init_r(void
  }
  
  
+ /*
+  * Additional PHY intialization. After being reset in mpc5xxx_fec_init_phy(),
+  * PHY goes into FX mode.  To take it out of the FX mode and switch into
+  * desired TX operation, one needs to clear the FX_SEL bit of Mode Control
+  * Register.
+  */
+ void reset_phy(void)
+ {
+       unsigned short mode_control;
+       miiphy_read("FEC ETHERNET", CONFIG_PHY_ADDR, 0x15, &mode_control);
+       miiphy_write("FEC ETHERNET", CONFIG_PHY_ADDR, 0x15,
+                       mode_control & 0xfffe);
+       return;
+ }
  #ifndef CFG_RAMBOOT
  /*
   * Helper function to initialize SDRAM controller.
   */
- static void sdram_start (int hi_addr)
+ static void sdram_start(int hi_addr)
  {
        long hi_addr_bit = hi_addr ? 0x01000000 : 0;
  
  /*
   * Initalize SDRAM - configure SDRAM controller, detect memory size.
   */
- long int initdram (int board_type)
+ long int initdram(int board_type)
  {
        ulong dramsize = 0;
  #ifndef CFG_RAMBOOT
                dramsize = 0;
  
        /* set SDRAM CS0 size according to the amount of RAM found */
 -      if (dramsize > 0)
 +      if (dramsize > 0) {
                *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
                        __builtin_ffs(dramsize >> 20) - 1;
 -        else
 +      } else {
                *(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
 +      }
  
        /* let SDRAM CS1 start right after CS0 and disable it */
        *(vu_long *) MPC5XXX_SDRAM_CS1CFG = dramsize;
  }
  
  
- int checkboard (void)
+ int checkboard(void)
  {
-       puts("Board: Promess Motion-PRO board\n");
+       uchar rev = *(vu_char *)CPLD_REV_REGISTER;
+       printf("Board: Promess Motion-PRO board (CPLD rev. 0x%02x)\n", rev);
        return 0;
  }
  
@@@ -181,3 -201,29 +202,29 @@@ void ft_board_setup(void *blob, bd_t *b
        ft_cpu_setup(blob, bd);
  }
  #endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */
+ #if defined(CONFIG_STATUS_LED)
+ void __led_init(led_id_t regaddr, int state)
+ {
+       *((vu_long *) regaddr) |= ENABLE_GPIO_OUT;
+       if (state == STATUS_LED_ON)
+               *((vu_long *) regaddr) |= LED_ON;
+       else
+               *((vu_long *) regaddr) &= ~LED_ON;
+ }
+ void __led_set(led_id_t regaddr, int state)
+ {
+       if (state == STATUS_LED_ON)
+               *((vu_long *) regaddr) |= LED_ON;
+       else
+               *((vu_long *) regaddr) &= ~LED_ON;
+ }
+ void __led_toggle(led_id_t regaddr)
+ {
+       *((vu_long *) regaddr) ^= LED_ON;
+ }
+ #endif /* CONFIG_STATUS_LED */
diff --combined common/main.c
@@@ -112,6 -112,14 +112,6 @@@ static __inline__ int abortboot(int boo
        u_int presskey_max = 0;
        u_int i;
  
 -#ifdef CONFIG_SILENT_CONSOLE
 -      if (gd->flags & GD_FLG_SILENT) {
 -              /* Restore serial console */
 -              console_assign (stdout, "serial");
 -              console_assign (stderr, "serial");
 -      }
 -#endif
 -
  #  ifdef CONFIG_AUTOBOOT_PROMPT
        printf (CONFIG_AUTOBOOT_PROMPT, bootdelay);
  #  endif
  #  endif
  
  #ifdef CONFIG_SILENT_CONSOLE
 -      if (abort) {
 -              /* permanently enable normal console output */
 -              gd->flags &= ~(GD_FLG_SILENT);
 -      } else if (gd->flags & GD_FLG_SILENT) {
 -              /* Restore silent console */
 -              console_assign (stdout, "nulldev");
 -              console_assign (stderr, "nulldev");
 -      }
 +      if (abort)
 +              gd->flags &= ~GD_FLG_SILENT;
  #endif
  
        return abort;
@@@ -208,6 -222,14 +208,6 @@@ static __inline__ int abortboot(int boo
  {
        int abort = 0;
  
 -#ifdef CONFIG_SILENT_CONSOLE
 -      if (gd->flags & GD_FLG_SILENT) {
 -              /* Restore serial console */
 -              console_assign (stdout, "serial");
 -              console_assign (stderr, "serial");
 -      }
 -#endif
 -
  #ifdef CONFIG_MENUPROMPT
        printf(CONFIG_MENUPROMPT, bootdelay);
  #else
                if (tstc()) {   /* we got a key press   */
                        (void) getc();  /* consume input        */
                        puts ("\b\b\b 0");
 -                      abort = 1;      /* don't auto boot      */
 +                      abort = 1;      /* don't auto boot      */
                }
        }
  #endif
        putc ('\n');
  
  #ifdef CONFIG_SILENT_CONSOLE
 -      if (abort) {
 -              /* permanently enable normal console output */
 -              gd->flags &= ~(GD_FLG_SILENT);
 -      } else if (gd->flags & GD_FLG_SILENT) {
 -              /* Restore silent console */
 -              console_assign (stdout, "nulldev");
 -              console_assign (stderr, "nulldev");
 -      }
 +      if (abort)
 +              gd->flags &= ~GD_FLG_SILENT;
  #endif
  
        return abort;
@@@ -1191,6 -1219,8 +1191,8 @@@ static void process_macros (const char 
  
        if (outputcnt)
                *output = 0;
+       else
+               *(output - 1) = 0;
  
  #ifdef DEBUG_PARSER
        printf ("[PROCESS_MACROS] OUTPUT len %d: \"%s\"\n",
diff --combined cpu/mpc5xxx/fec.c
@@@ -395,9 -395,7 +395,7 @@@ static int mpc5xxx_fec_init(struct eth_
  static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
  {
        mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
- #ifndef CONFIG_MOTIONPRO
        const uint8 phyAddr = CONFIG_PHY_ADDR;  /* Only one PHY */
- #endif /* !CONFIG_MOTIONPRO */
  
  #if (DEBUG & 0x1)
        printf ("mpc5xxx_fec_init_phy... Begin\n");
   * PHY initialization for the Motion-PRO board, until a proper fix is found.
   */
  
- #ifndef CONFIG_MOTIONPRO
        if (fec->xcv_type != SEVENWIRE) {
                /*
                 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
                miiphy_write(dev->name, phyAddr, 0x0, 0x8000);
                udelay(1000);
  
 +#if defined(CONFIG_UC101)
 +              /* Set the LED configuration Register for the UC101 Board */
 +              miiphy_write(dev->name, phyAddr, 0x14, 0x4122);
 +#endif
                if (fec->xcv_type == MII10) {
                        /*
                         * Force 10Base-T, FDX operation
                }
  
        }
- #endif /* !CONFIG_MOTIONPRO */
  
  #if (DEBUG & 0x2)
        if (fec->xcv_type != SEVENWIRE)
@@@ -893,13 -885,12 +889,13 @@@ int mpc5xxx_fec_initialize(bd_t * bis
        fec->eth = (ethernet_regs *)MPC5XXX_FEC;
        fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
        fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD));
 -#if defined(CONFIG_CANMB)   || defined(CONFIG_HMI1001)        || \
 -    defined(CONFIG_ICECUBE) || defined(CONFIG_INKA4X0)        || \
 -    defined(CONFIG_MCC200)  || defined(CONFIG_MOTIONPRO)      || \
 -    defined(CONFIG_O2DNT)   || defined(CONFIG_PM520)  || \
 -    defined(CONFIG_TOP5200) || defined(CONFIG_TQM5200)        || \
 -    defined(CONFIG_UC101)   || defined(CONFIG_V38B)
 +#if defined(CONFIG_CANMB)    || defined(CONFIG_HMI1001)       || \
 +    defined(CONFIG_ICECUBE)  || defined(CONFIG_INKA4X0)       || \
 +    defined(CONFIG_JUPITER)  || defined(CONFIG_MCC200)        || \
 +    defined(CONFIG_MOTIONPRO)|| defined(CONFIG_O2DNT) || \
 +    defined(CONFIG_PM520)    || defined(CONFIG_TOP5200)       || \
 +    defined(CONFIG_TQM5200)  || defined(CONFIG_UC101) || \
 +    defined(CONFIG_V38B)
  # ifndef CONFIG_FEC_10MBIT
        fec->xcv_type = MII100;
  # else
   * IPB Bus clocking configuration.
   */
  #if defined(CONFIG_LITE5200B)
- #define CFG_IPBSPEED_133      /* define for 133MHz speed */
+ #define CFG_IPBCLK_EQUALS_XLBCLK      /* define for 133MHz speed */
  #else
- #undef CFG_IPBSPEED_133       /* define for 133MHz speed */
+ #undef CFG_IPBCLK_EQUALS_XLBCLK       /* define for 133MHz speed */
  #endif
  #endif /* CONFIG_MPC5200 */
  
  
  #define OF_CPU                        "PowerPC,5200@0"
  #define OF_SOC                        "soc5200@f0000000"
 -#define OF_TBCLK              (bd->bi_busfreq / 8)
 +#define OF_TBCLK              (bd->bi_busfreq / 4)
  #define OF_STDOUT_PATH                "/soc5200@f0000000/serial@2000"
  
  /*
  /*
   * IPB Bus clocking configuration.
   */
- #undef CFG_IPBSPEED_133               /* define for 133MHz speed */
+ #undef CFG_IPBCLK_EQUALS_XLBCLK               /* define for 133MHz speed */
  
  /*
   * I2C configuration
   */
  #define CONFIG_MPC5xxx_FEC    1
  #define CONFIG_PHY_ADDR               0x00
 +#define CONFIG_MII            1               /* MII PHY management           */
  
  /*
   * GPIO configuration
diff --combined include/configs/mcc200.h
  /*
   * IPB Bus clocking configuration.
   */
- #define CFG_IPBSPEED_133              /* define for 133MHz speed */
+ #define CFG_IPBCLK_EQUALS_XLBCLK              /* define for 133MHz speed */
  
  /*
   * I2C configuration
   */
  #if !defined(CONFIG_PRS200)
  #define CONFIG_LCD            1
 +#define CONFIG_PROGRESSBAR 1
  #endif
  
  #if defined(CONFIG_LCD)