GCC-4.x fixes: clean up global data pointer initialization for all boards.
diff --git a/cpu/mpc8260/commproc.c b/cpu/mpc8260/commproc.c
index e5c5fcf..8777e77 100644
--- a/cpu/mpc8260/commproc.c
+++ b/cpu/mpc8260/commproc.c
@@ -20,11 +20,11 @@
#include <common.h>
#include <asm/cpm_8260.h>
+DECLARE_GLOBAL_DATA_PTR;
+
void
m8260_cpm_reset(void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *)CFG_IMMR;
volatile ulong count;
@@ -54,8 +54,6 @@
uint
m8260_cpm_dpalloc(uint size, uint align)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *)CFG_IMMR;
uint retloc;
uint align_mask, off;
@@ -112,8 +110,6 @@
void
m8260_cpm_setbrg(uint brg, uint rate)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *)CFG_IMMR;
volatile uint *bp;
uint cd = BRG_UART_CLK / rate;
@@ -137,8 +133,6 @@
void
m8260_cpm_fastbrg(uint brg, uint rate, int div16)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *)CFG_IMMR;
volatile uint *bp;
diff --git a/cpu/mpc8260/cpu.c b/cpu/mpc8260/cpu.c
index 5d97933..4f23012 100644
--- a/cpu/mpc8260/cpu.c
+++ b/cpu/mpc8260/cpu.c
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 2000-2003
+ * (C) Copyright 2000-2006
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
@@ -47,10 +47,10 @@
#include <asm/processor.h>
#include <asm/cpm_8260.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int checkcpu (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immap = (immap_t *) CFG_IMMR;
ulong clock = gd->cpu_clk;
uint pvr = get_pvr ();
@@ -264,8 +264,6 @@
*/
unsigned long get_tbclk (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
ulong tbclk;
tbclk = (gd->bus_clk + 3L) / 4L;
diff --git a/cpu/mpc8260/cpu_init.c b/cpu/mpc8260/cpu_init.c
index babcce4..640026b 100644
--- a/cpu/mpc8260/cpu_init.c
+++ b/cpu/mpc8260/cpu_init.c
@@ -26,6 +26,8 @@
#include <asm/cpm_8260.h>
#include <ioports.h>
+DECLARE_GLOBAL_DATA_PTR;
+
static void config_8260_ioports (volatile immap_t * immr)
{
int portnum;
@@ -97,7 +99,6 @@
*/
void cpu_init_f (volatile immap_t * immr)
{
- DECLARE_GLOBAL_DATA_PTR;
#if !defined(CONFIG_COGENT) /* done in start.S for the cogent */
uint sccr;
#endif
@@ -222,8 +223,6 @@
*/
int cpu_init_r (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *) gd->bd->bi_immr_base;
immr->im_cpm.cp_rccr = CFG_RCCR;
@@ -236,8 +235,6 @@
*/
int prt_8260_rsr (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
static struct {
ulong mask;
char *desc;
diff --git a/cpu/mpc8260/ether_fcc.c b/cpu/mpc8260/ether_fcc.c
index ed3515f..584c40f 100644
--- a/cpu/mpc8260/ether_fcc.c
+++ b/cpu/mpc8260/ether_fcc.c
@@ -51,6 +51,8 @@
#include <miiphy.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
#if defined(CONFIG_ETHER_ON_FCC) && (CONFIG_COMMANDS & CFG_CMD_NET) && \
defined(CONFIG_NET_MULTI)
@@ -644,8 +646,6 @@
void
eth_loopback_test (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *)CFG_IMMR;
volatile cpm8260_t *cp = &(immr->im_cpm);
int c, nclosed;
diff --git a/cpu/mpc8260/i2c.c b/cpu/mpc8260/i2c.c
index ea97ab8..34bd389 100644
--- a/cpu/mpc8260/i2c.c
+++ b/cpu/mpc8260/i2c.c
@@ -34,6 +34,8 @@
/* define to enable debug messages */
#undef DEBUG_I2C
+DECLARE_GLOBAL_DATA_PTR;
+
/* uSec to wait between polls of the i2c */
#define DELAY_US 100
/* uSec to wait for the CPM to start processing the buffer */
@@ -213,8 +215,6 @@
void i2c_init(int speed, int slaveadd)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immap = (immap_t *)CFG_IMMR ;
volatile cpm8260_t *cp = (cpm8260_t *)&immap->im_cpm;
volatile i2c8260_t *i2c = (i2c8260_t *)&immap->im_i2c;
diff --git a/cpu/mpc8260/interrupts.c b/cpu/mpc8260/interrupts.c
index b2e4d83..56e9a72 100644
--- a/cpu/mpc8260/interrupts.c
+++ b/cpu/mpc8260/interrupts.c
@@ -29,6 +29,8 @@
#include <mpc8260_irq.h>
#include <asm/processor.h>
+DECLARE_GLOBAL_DATA_PTR;
+
/****************************************************************************/
struct irq_action {
@@ -140,8 +142,6 @@
int interrupt_init_cpu (unsigned *decrementer_count)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immr = (immap_t *) CFG_IMMR;
*decrementer_count = (gd->bus_clk / 4) / CFG_HZ;
diff --git a/cpu/mpc8260/pci.c b/cpu/mpc8260/pci.c
index 44576de..ea5514f 100644
--- a/cpu/mpc8260/pci.c
+++ b/cpu/mpc8260/pci.c
@@ -33,6 +33,11 @@
#include <mpc8260.h>
#include <asm/m8260_pci.h>
#include <asm/io.h>
+
+#if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
/*
* Local->PCI map (from CPU) controlled by
* MPC826x master window
@@ -234,9 +239,6 @@
void pci_mpc8250_init (struct pci_controller *hose)
{
-#if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272
- DECLARE_GLOBAL_DATA_PTR;
-#endif
u16 tempShort;
volatile immap_t *immap = (immap_t *) CFG_IMMR;
diff --git a/cpu/mpc8260/serial_scc.c b/cpu/mpc8260/serial_scc.c
index 32016f2..3a6eaf0 100644
--- a/cpu/mpc8260/serial_scc.c
+++ b/cpu/mpc8260/serial_scc.c
@@ -32,6 +32,8 @@
#include <mpc8260.h>
#include <asm/cpm_8260.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if defined(CONFIG_CONS_ON_SCC)
#if CONFIG_CONS_INDEX == 1 /* Console on SCC1 */
@@ -181,8 +183,6 @@
void
serial_setbrg (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
#if defined(CONFIG_CONS_USE_EXTC)
m8260_cpm_extcbrg(SCC_INDEX, gd->baudrate,
CONFIG_CONS_EXTC_RATE, CONFIG_CONS_EXTC_PINSEL);
diff --git a/cpu/mpc8260/serial_smc.c b/cpu/mpc8260/serial_smc.c
index b486f83..f3dffeb 100644
--- a/cpu/mpc8260/serial_smc.c
+++ b/cpu/mpc8260/serial_smc.c
@@ -34,6 +34,8 @@
#include <mpc8260.h>
#include <asm/cpm_8260.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#if defined(CONFIG_CONS_ON_SMC)
#if CONFIG_CONS_INDEX == 1 /* Console on SMC1 */
@@ -170,8 +172,6 @@
void
serial_setbrg (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
#if defined(CONFIG_CONS_USE_EXTC)
m8260_cpm_extcbrg(brg_map[SMC_INDEX], gd->baudrate,
CONFIG_CONS_EXTC_RATE, CONFIG_CONS_EXTC_PINSEL);
diff --git a/cpu/mpc8260/speed.c b/cpu/mpc8260/speed.c
index 99afe76..360404f 100644
--- a/cpu/mpc8260/speed.c
+++ b/cpu/mpc8260/speed.c
@@ -25,6 +25,8 @@
#include <mpc8260.h>
#include <asm/processor.h>
+DECLARE_GLOBAL_DATA_PTR;
+
/* ------------------------------------------------------------------------- */
/* Bus-to-Core Multiplier */
@@ -101,8 +103,6 @@
int get_clocks (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immap = (immap_t *) CFG_IMMR;
ulong clkin;
ulong sccr, dfbrg;
@@ -159,8 +159,6 @@
int prt_8260_clks (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile immap_t *immap = (immap_t *) CFG_IMMR;
ulong sccr, dfbrg;
ulong scmr, corecnf, busdf, cpmdf, plldf, pllmf, pcidf;