GCC-4.x fixes: clean up global data pointer initialization for all boards.
diff --git a/cpu/mpc8xx/commproc.c b/cpu/mpc8xx/commproc.c
index 75740e0..07c763c 100644
--- a/cpu/mpc8xx/commproc.c
+++ b/cpu/mpc8xx/commproc.c
@@ -24,12 +24,12 @@
#include <common.h>
#include <commproc.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef CFG_ALLOC_DPRAM
int dpram_init (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
/* Reclaim the DP memory for our use. */
gd->dp_alloc_base = CPM_DATAONLY_BASE;
gd->dp_alloc_top = CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE;
@@ -43,7 +43,6 @@
*/
uint dpram_alloc (uint size)
{
- DECLARE_GLOBAL_DATA_PTR;
uint addr = gd->dp_alloc_base;
if ((gd->dp_alloc_base + size) >= gd->dp_alloc_top)
@@ -56,8 +55,6 @@
uint dpram_base (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
return gd->dp_alloc_base;
}
@@ -67,8 +64,6 @@
*/
uint dpram_alloc_align (uint size, uint align)
{
- DECLARE_GLOBAL_DATA_PTR;
-
uint addr, mask = align - 1;
addr = (gd->dp_alloc_base + mask) & ~mask;
@@ -83,8 +78,6 @@
uint dpram_base_align (uint align)
{
- DECLARE_GLOBAL_DATA_PTR;
-
uint mask = align - 1;
return (gd->dp_alloc_base + mask) & ~mask;
diff --git a/cpu/mpc8xx/cpu.c b/cpu/mpc8xx/cpu.c
index c4a0cba..97112f0 100644
--- a/cpu/mpc8xx/cpu.c
+++ b/cpu/mpc8xx/cpu.c
@@ -39,6 +39,8 @@
#include <mpc8xx.h>
#include <asm/cache.h>
+DECLARE_GLOBAL_DATA_PTR;
+
static char *cpu_warning = "\n " \
"*** Warning: CPU Core has Silicon Bugs -- Check the Errata ***";
@@ -349,8 +351,6 @@
int checkcpu (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
ulong clock = gd->cpu_clk;
uint immr = get_immr (0); /* Return full IMMR contents */
uint pvr = get_pvr ();
@@ -539,8 +539,6 @@
*/
unsigned long get_tbclk (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
uint immr = get_immr (0); /* Return full IMMR contents */
volatile immap_t *immap = (volatile immap_t *)(immr & 0xFFFF0000);
ulong oscclk, factor, pll;
diff --git a/cpu/mpc8xx/cpu_init.c b/cpu/mpc8xx/cpu_init.c
index b2c59c6..1a7111f 100644
--- a/cpu/mpc8xx/cpu_init.c
+++ b/cpu/mpc8xx/cpu_init.c
@@ -27,6 +27,10 @@
#include <mpc8xx.h>
#include <commproc.h>
+#if defined(CFG_RTCSC) || defined(CFG_RMDS)
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
#if defined(CFG_I2C_UCODE_PATCH) || defined(CFG_SPI_UCODE_PATCH)
void cpm_load_patch (volatile immap_t * immr);
#endif
@@ -259,8 +263,6 @@
int cpu_init_r (void)
{
#if defined(CFG_RTCSC) || defined(CFG_RMDS)
- DECLARE_GLOBAL_DATA_PTR;
-
bd_t *bd = gd->bd;
volatile immap_t *immr = (volatile immap_t *) (bd->bi_immr_base);
#endif
diff --git a/cpu/mpc8xx/fec.c b/cpu/mpc8xx/fec.c
index d2f5d88..6006478 100644
--- a/cpu/mpc8xx/fec.c
+++ b/cpu/mpc8xx/fec.c
@@ -27,6 +27,8 @@
#include <net.h>
#include <command.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#undef ET_DEBUG
#if (CONFIG_COMMANDS & CFG_CMD_NET) && \
@@ -371,7 +373,6 @@
static void fec_pin_init(int fecidx)
{
- DECLARE_GLOBAL_DATA_PTR;
bd_t *bd = gd->bd;
volatile immap_t *immr = (immap_t *) CFG_IMMR;
volatile fec_t *fecp;
diff --git a/cpu/mpc8xx/i2c.c b/cpu/mpc8xx/i2c.c
index 682db53..6c59374 100644
--- a/cpu/mpc8xx/i2c.c
+++ b/cpu/mpc8xx/i2c.c
@@ -37,6 +37,8 @@
#include <watchdog.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
/* define to enable debug messages */
#undef DEBUG_I2C
@@ -205,8 +207,6 @@
void
i2c_init(int speed, int slaveaddr)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immap = (immap_t *)CFG_IMMR ;
volatile cpm8xx_t *cp = (cpm8xx_t *)&immap->im_cpm;
volatile i2c8xx_t *i2c = (i2c8xx_t *)&immap->im_i2c;
@@ -615,8 +615,6 @@
int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
{
- DECLARE_GLOBAL_DATA_PTR;
-
i2c_state_t state;
uchar xaddr[4];
int rc;
@@ -671,8 +669,6 @@
int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
{
- DECLARE_GLOBAL_DATA_PTR;
-
i2c_state_t state;
uchar xaddr[4];
int rc;
diff --git a/cpu/mpc8xx/serial.c b/cpu/mpc8xx/serial.c
index fa0405f1..26a82cc 100644
--- a/cpu/mpc8xx/serial.c
+++ b/cpu/mpc8xx/serial.c
@@ -27,6 +27,8 @@
#include <serial.h>
#include <watchdog.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if !defined(CONFIG_8xx_CONS_NONE) /* No Console at all */
#if defined(CONFIG_8xx_CONS_SMC1) /* Console on SMC1 */
@@ -65,7 +67,6 @@
static void serial_setdivisor(volatile cpm8xx_t *cp)
{
- DECLARE_GLOBAL_DATA_PTR;
int divisor=(gd->cpu_clk + 8*gd->baudrate)/16/gd->baudrate;
if(divisor/16>0x1000) {
@@ -268,8 +269,6 @@
volatile cpm8xx_t *cpmp = &(im->im_cpm);
#ifdef CONFIG_MODEM_SUPPORT
- DECLARE_GLOBAL_DATA_PTR;
-
if (gd->be_quiet)
return;
#endif
@@ -553,8 +552,6 @@
volatile cpm8xx_t *cpmp = &(im->im_cpm);
#ifdef CONFIG_MODEM_SUPPORT
- DECLARE_GLOBAL_DATA_PTR;
-
if (gd->be_quiet)
return;
#endif
@@ -649,13 +646,11 @@
#ifdef CONFIG_MODEM_SUPPORT
void disable_putc(void)
{
- DECLARE_GLOBAL_DATA_PTR;
gd->be_quiet = 1;
}
void enable_putc(void)
{
- DECLARE_GLOBAL_DATA_PTR;
gd->be_quiet = 0;
}
#endif
diff --git a/cpu/mpc8xx/speed.c b/cpu/mpc8xx/speed.c
index f038316..57f91c0 100644
--- a/cpu/mpc8xx/speed.c
+++ b/cpu/mpc8xx/speed.c
@@ -25,6 +25,8 @@
#include <mpc8xx.h>
#include <asm/processor.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if !defined(CONFIG_8xx_CPUCLK_DEFAULT) || defined(CFG_MEASURE_CPUCLK) || defined(DEBUG)
#define PITC_SHIFT 16
@@ -181,8 +183,6 @@
*/
int get_clocks (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
uint immr = get_immr (0); /* Return full IMMR contents */
volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
uint sccr = immap->im_clkrst.car_sccr;
@@ -238,8 +238,6 @@
*/
int get_clocks_866 (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *) CFG_IMMR;
char tmp[64];
long cpuclk = 0;
@@ -277,8 +275,6 @@
*/
int sdram_adjust_866 (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *) CFG_IMMR;
long mamr;
@@ -371,8 +367,6 @@
*/
int adjust_sdram_tbs_8xx (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *) CFG_IMMR;
long mamr;
long sccr;
diff --git a/cpu/mpc8xx/video.c b/cpu/mpc8xx/video.c
index ee60477..918de67 100644
--- a/cpu/mpc8xx/video.c
+++ b/cpu/mpc8xx/video.c
@@ -39,6 +39,8 @@
#ifdef CONFIG_VIDEO
+DECLARE_GLOBAL_DATA_PTR;
+
/************************************************************************/
/* ** DEBUG SETTINGS */
/************************************************************************/
@@ -1164,7 +1166,6 @@
u16 *screen = video_fb_address, width = VIDEO_COLS;
#ifdef VIDEO_INFO
# ifndef CONFIG_FADS
- DECLARE_GLOBAL_DATA_PTR;
char temp[32];
# endif
char info[80];
@@ -1282,8 +1283,6 @@
int drv_video_init (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
int error, devices = 1;
device_t videodev;