All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
@ 2012-11-16 21:19 Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 01/57] Add architecture-specific global data Simon Glass
                   ` (57 more replies)
  0 siblings, 58 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

The previous generic board series hit a snag in that we needed generic
code to access some of the architecture-specific fields in global_data.

The solution eventually arrived at was to move these fields into a
separate structure, so that global_data has the generic fields,
and within that there is an arch_global_data structure holding the
architecture-specific ones.

This series makes that change. Assuming this is reasonable, the next
step is to bring back the generic board patches on top of this.

A few minor points need to be resolved in this series:
- if it's ok with everyone, drop include/asm-generic/global_data_flags.h,
since it should not be needed now
- possibly unify brg_clk on powerpc (but that would involve unifying some
ifdefs
- decide what to do about PCI clock being present with there is no
CONFIG_PCI. It seem wrong to me, but I haven't changed it for this series.

I have completed a build of all commits for all builds and see no
regressions. But the following boards had errors/warnings, so it seems I
need to continue working on my toolchains:

  blackfin:   + bf561-acvilon  + dnp5370  + cm-bf561  + blackstamp  + br4
  + bct-brettl2  + cm-bf527  + bf506f-ezkit  + ip04  + bf527-sdp
+ bf537-stamp  + bf527-ezkit-v2  + cm-bf537e  + tcm-bf518  + cm-bf537u
+ bf527-ezkit  + bf537-pnav  + cm-bf533  + pr1  + bf533-ezkit
+ ibf-dsp561  + bf537-srv1  + cm-bf548  + bf537-minotaur  + bf538f-ezkit
+ bf548-ezkit  + bf525-ucr2  + blackvme  + tcm-bf537  + bf533-stamp
+ bf518f-ezbrd  + bf527-ad7160-eval  + bf526-ezbrd  + bf561-ezkit
     avr32:   + hammerhead  + atngw100mkii  + grasshopper  + favr-32-ezkit
+ atstk1006  + atstk1004  + atstk1003  + atstk1002  + atngw100  + mimc200
      m68k:   + M5235EVB_Flash32  + M54455EVB_a66  + M5329AFEE  + M5249EVB
+ idmr  + M5208EVBE  + eb_cpu5282  + M5475FFE  + M54451EVB  + astro_mcf5373l
+ M54418TWR_serial_rmii  + M54455EVB_intel  + M5282EVB  + M54455EVB_i66
+ M5475GFE  + M5253DEMO  + M54455EVB_stm33  + M5253EVBE  + M5485BFE
+ M5485DFE  + M5329BFEE  + M52277EVB  + M5475EFE  + M54418TWR_nand_mii
+ M5475CFE  + cobra5272  + M5485AFE  + M53017EVB  + M5475AFE  + M5485HFE
+ M5235EVB  + M5275EVB  + M5271EVB  + M54418TWR_nand_rmii_lowfreq  + TASREG
+ M5475BFE  + M5475DFE  + M52277EVB_stmicro  + eb_cpu5282_internal
+ M54451EVB_stmicro  + M5485GFE  + M5373EVB  + M5485EFE  + M5485FFE
+ M54418TWR  + M54418TWR_nand_rmii  + M54418TWR_serial_mii  + M5485CFE
+ M54455EVB  + M5272C3
   powerpc:   + MPC8641HPCN_36BIT  + MPC8641HPCN  + xpedite517x  + MVBLM7
+ MVSMR
     sparc:   + grsim  + grsim_leon2  + gr_cpci_ax2000  + gr_xc3s_1500
+ gr_ep2s60
        sh:   + ap_sh4a_4a  + ms7750se  + sh7763rdp  + r0p7734  + r2dplus
+ ms7720se  + rsk7269  + rsk7264  + shmin  + sh7757lcr  + espt  + mpr2
+ ms7722se  + r7780mp  + ecovec  + rsk7203  + MigoR  + sh7785lcr_32bit
+ sh7785lcr  + ap325rxa
     nios2:   + PK1C20  + PCI5441  + nios2-generic
microblaze:   + microblaze-generic
  openrisc:   + openrisc-generic
      mips:   + incaip_150MHz  + pb1000  + vct_premium_onenand
+ vct_platinum  + qemu_mips  + vct_premium_small  + dbau1100
+ vct_platinumavc_small  + vct_premium_onenand_small  + incaip
+ vct_platinum_small  + dbau1550  + dbau1500  + qemu_mips64el  + vct_platinumavc_onenand_small  + incaip_133MHz  + vct_platinum_onenand_small
+ vct_premium  + vct_platinumavc_onenand  + qemu_mips64  + qi_lb60
+ vct_platinumavc  + incaip_100MHz  + vct_platinum_onenand  + qemu_mipsel
+ dbau1550_el  + dbau1000
       arm:   + VCMA9  + smdk2410
     nds32:   + adp-ag101p  + adp-ag102  + adp-ag101



Simon Glass (57):
  Add architecture-specific global data
  at91: Move at91 global data into arch_global_data
  arm: Move timer_rate_hz into arch_global_data
  arm: Move tbu to arch_global_data
  arm: Move tbl to arch_global_data
  arm: Move lastinc to arch_global_data
  arm: Move timer_reset_value to arch_global_data
  ixp: Move timestamp to arch_global_data
  nds32: Drop tlb_addr from global data
  arm: Move tlb_addr to arch_global_data
  x86: Move gdt_addr, new_gd_addr to arch_global_data
  x86: Remove reset_status, relocoff from global_data
  x86: Move new_gd_addr to arch_global_data
  ppc: Move brg_clk to arch_global_data
  ppc: Remove extra pci_clk fields from global_data
  ppc: Move clock fields to arch_global_data
  ppc: Move mpc83xx clock fields to arch_global_data
  ppc: Move lbc_clk and cpu to arch_global_data
  ppc: m68k: Move i2c1_clk, i2c2_clk to arch_global_data
  ppc: Move CONFIG_QE to arch_global_data
  ppc: Move used_laws to arch_global_data
  ppc: Move used_tlb_cams to arch_global_data
  ppc: Move mpc5xxx clocks to arch_global_data
  ppc: Move mpc512x clocks to arch_global_data
  ppc: Move mpc8220 clocks to arch_global_data
  ppc: Move reset_status to arch_global_data
  ppc: Move arbiter fields to arch_global_data
  ppc: Move dp_alloc_base, dp_alloc_top to arch_global_data
  arm: Move uart_clk to arch_global_data
  ppc: Move mirror_hack to arch_global_data
  ppc: Remove console_addr from global data
  ppc: Move fpga_state to arch_global_data
  ppc: Move wdt_last to arch_global_data
  ppc: Move kbd_status to arch_global_data
  ppc: arm: Move sdhc_clk into arch_global_data
  sparc: Drop kbd_status and reset_status from global_data
  m68k: Move CONFIG_EXTRA_CLOCK to arch_global_data
  mips: Move per_clk and dev_clk to arch_global_data
  avr32: Move stack_end to arch_global_data
  avr32: Move cpu_hz to arch_global_data
  sandbox: Move ram_buf to arch_global_data
  Add generic global_data
  Only use fb_base if we have a display
  arm: Use generic global_data
  avr32: Use generic global_data
  blackfin: Use generic global_data
  m68k: Use generic global_data
  microblaze: Use generic global_data
  mips: Use generic global_data
  nds32: Use generic global_data
  nios2: Use generic global_data
  openrisc: Use generic global_data
  powerpc: Use generic global_data
  sandbox: Use generic global_data
  sh: Use generic global_data
  sparc: Use generic global_data
  x86: Use generic global_data

 arch/arm/cpu/arm1136/mx31/timer.c          |   10 +-
 arch/arm/cpu/arm1136/mx35/generic.c        |    6 +-
 arch/arm/cpu/arm1136/mx35/timer.c          |    4 +-
 arch/arm/cpu/arm1136/omap24xx/timer.c      |   23 +++--
 arch/arm/cpu/arm920t/a320/timer.c          |   18 ++--
 arch/arm/cpu/arm920t/at91/clock.c          |   24 +++--
 arch/arm/cpu/arm920t/at91/timer.c          |   14 ++--
 arch/arm/cpu/arm920t/s3c24x0/timer.c       |   30 +++---
 arch/arm/cpu/arm926ejs/armada100/timer.c   |   18 ++--
 arch/arm/cpu/arm926ejs/at91/clock.c        |   30 +++---
 arch/arm/cpu/arm926ejs/at91/timer.c        |   18 ++--
 arch/arm/cpu/arm926ejs/davinci/timer.c     |   21 ++--
 arch/arm/cpu/arm926ejs/kirkwood/timer.c    |    4 +-
 arch/arm/cpu/arm926ejs/mb86r0x/timer.c     |    4 +-
 arch/arm/cpu/arm926ejs/mx25/generic.c      |    4 +-
 arch/arm/cpu/arm926ejs/mx25/timer.c        |    4 +-
 arch/arm/cpu/arm926ejs/mx27/timer.c        |    4 +-
 arch/arm/cpu/arm926ejs/mxs/timer.c         |    4 +-
 arch/arm/cpu/arm926ejs/omap/timer.c        |    4 +-
 arch/arm/cpu/arm926ejs/orion5x/timer.c     |    4 +-
 arch/arm/cpu/arm926ejs/pantheon/timer.c    |   18 ++--
 arch/arm/cpu/arm926ejs/spear/timer.c       |    4 +-
 arch/arm/cpu/arm926ejs/versatile/timer.c   |    4 +-
 arch/arm/cpu/armv7/omap-common/timer.c     |   20 ++--
 arch/arm/cpu/armv7/s5p-common/timer.c      |   14 ++--
 arch/arm/cpu/armv7/socfpga/timer.c         |   15 ++--
 arch/arm/cpu/armv7/u8500/timer.c           |   16 ++--
 arch/arm/cpu/armv7/zynq/timer.c            |   14 ++--
 arch/arm/cpu/ixp/timer.c                   |   12 +-
 arch/arm/cpu/pxa/timer.c                   |    4 +-
 arch/arm/cpu/tegra-common/timer.c          |   12 +-
 arch/arm/imx-common/speed.c                |   16 ++--
 arch/arm/imx-common/timer.c                |    4 +-
 arch/arm/include/asm/arch-at91/clk.h       |   12 +-
 arch/arm/include/asm/global_data.h         |   58 +++---------
 arch/arm/lib/board.c                       |    2 +-
 arch/arm/lib/cache-cp15.c                  |    4 +-
 arch/avr32/cpu/cpu.c                       |    4 +-
 arch/avr32/cpu/exception.c                 |    6 +-
 arch/avr32/cpu/interrupts.c                |    6 +-
 arch/avr32/include/asm/global_data.h       |   34 +------
 arch/avr32/lib/board.c                     |    2 +-
 arch/avr32/lib/bootm.c                     |    2 +-
 arch/blackfin/include/asm/global_data.h    |   33 +------
 arch/m68k/cpu/mcf5227x/cpu.c               |    6 +-
 arch/m68k/cpu/mcf5227x/speed.c             |   12 +-
 arch/m68k/cpu/mcf523x/speed.c              |    2 +-
 arch/m68k/cpu/mcf52x2/speed.c              |    4 +-
 arch/m68k/cpu/mcf532x/speed.c              |    2 +-
 arch/m68k/cpu/mcf5445x/cpu.c               |   10 +-
 arch/m68k/cpu/mcf5445x/speed.c             |   14 ++--
 arch/m68k/cpu/mcf547x_8x/speed.c           |    2 +-
 arch/m68k/include/asm/global_data.h        |   47 ++--------
 arch/m68k/lib/board.c                      |    6 +-
 arch/microblaze/include/asm/global_data.h  |   27 +-----
 arch/mips/cpu/xburst/timer.c               |   20 ++--
 arch/mips/include/asm/global_data.h        |   38 +-------
 arch/nds32/include/asm/global_data.h       |   35 +------
 arch/nds32/lib/board.c                     |   11 --
 arch/nios2/include/asm/global_data.h       |   25 +----
 arch/openrisc/include/asm/global_data.h    |   25 +----
 arch/powerpc/cpu/mpc512x/cpu.c             |    4 +-
 arch/powerpc/cpu/mpc512x/cpu_init.c        |    2 +-
 arch/powerpc/cpu/mpc512x/i2c.c             |    2 +-
 arch/powerpc/cpu/mpc512x/ide.c             |    2 +-
 arch/powerpc/cpu/mpc512x/serial.c          |    2 +-
 arch/powerpc/cpu/mpc512x/speed.c           |   15 ++-
 arch/powerpc/cpu/mpc5xxx/i2c.c             |    2 +-
 arch/powerpc/cpu/mpc5xxx/ide.c             |    2 +-
 arch/powerpc/cpu/mpc5xxx/serial.c          |    4 +-
 arch/powerpc/cpu/mpc5xxx/speed.c           |   18 +++-
 arch/powerpc/cpu/mpc8220/fec.c             |    8 +-
 arch/powerpc/cpu/mpc8220/speed.c           |   12 ++-
 arch/powerpc/cpu/mpc8260/commproc.c        |   21 ++--
 arch/powerpc/cpu/mpc8260/cpu_init.c        |    4 +-
 arch/powerpc/cpu/mpc8260/i2c.c             |    2 +-
 arch/powerpc/cpu/mpc8260/speed.c           |   16 ++--
 arch/powerpc/cpu/mpc83xx/cpu.c             |    2 +-
 arch/powerpc/cpu/mpc83xx/cpu_init.c        |   32 ++++---
 arch/powerpc/cpu/mpc83xx/fdt.c             |    2 +-
 arch/powerpc/cpu/mpc83xx/pcie.c            |    4 +-
 arch/powerpc/cpu/mpc83xx/speed.c           |  108 +++++++++++++---------
 arch/powerpc/cpu/mpc85xx/commproc.c        |   21 ++--
 arch/powerpc/cpu/mpc85xx/cpu.c             |    2 +-
 arch/powerpc/cpu/mpc85xx/fdt.c             |    4 +-
 arch/powerpc/cpu/mpc85xx/speed.c           |   28 +++---
 arch/powerpc/cpu/mpc85xx/tlb.c             |    8 +-
 arch/powerpc/cpu/mpc86xx/cpu.c             |    2 +-
 arch/powerpc/cpu/mpc86xx/fdt.c             |    4 +-
 arch/powerpc/cpu/mpc86xx/speed.c           |    8 +-
 arch/powerpc/cpu/mpc8xx/commproc.c         |   20 ++--
 arch/powerpc/cpu/mpc8xx/fdt.c              |    2 +-
 arch/powerpc/cpu/mpc8xx/speed.c            |    2 +-
 arch/powerpc/cpu/mpc8xxx/cpu.c             |    8 +-
 arch/powerpc/cpu/ppc4xx/4xx_uart.c         |    4 +-
 arch/powerpc/cpu/ppc4xx/fdt.c              |    4 +-
 arch/powerpc/include/asm/global_data.h     |  140 +++++++++-------------------
 arch/powerpc/lib/board.c                   |   33 ++++---
 arch/sandbox/cpu/cpu.c                     |    2 +-
 arch/sandbox/include/asm/global_data.h     |   25 +----
 arch/sandbox/lib/board.c                   |    6 +-
 arch/sh/include/asm/global_data.h          |   21 +----
 arch/sparc/include/asm/global_data.h       |   51 +---------
 arch/x86/cpu/cpu.c                         |    2 +-
 arch/x86/include/asm/global_data.h         |   50 ++++-------
 arch/x86/lib/init_helpers.c                |   12 +-
 board/evb64260/mpsc.c                      |    2 +-
 board/freescale/bsc9131rdb/bsc9131rdb.c    |    2 +-
 board/freescale/corenet_ds/corenet_ds.c    |    2 +-
 board/freescale/p1010rdb/ddr.c             |    6 +-
 board/freescale/p1010rdb/p1010rdb.c        |    6 +-
 board/freescale/p1_p2_rdb/ddr.c            |    2 +-
 board/freescale/p1_p2_rdb/p1_p2_rdb.c      |    2 +-
 board/freescale/p2041rdb/p2041rdb.c        |    2 +-
 board/freescale/t4qds/t4qds.c              |    2 +-
 board/gdsys/405ep/405ep.c                  |   15 ++--
 board/gdsys/405ex/405ex.c                  |   13 ++-
 board/gdsys/405ex/io64.c                   |    2 +-
 board/inka4x0/inkadiag.c                   |    8 +-
 board/lwmon/lwmon.c                        |   10 +-
 board/lwmon5/kbd.c                         |   10 +-
 board/lwmon5/lwmon5.c                      |    8 +-
 common/cmd_bdinfo.c                        |    6 +-
 common/cmd_immap.c                         |    2 +-
 drivers/i2c/fsl_i2c.c                      |    7 +-
 drivers/input/ps2ser.c                     |    2 +-
 drivers/misc/fsl_law.c                     |   16 ++--
 drivers/mmc/fsl_esdhc.c                    |    6 +-
 drivers/net/mpc512x_fec.c                  |    2 +-
 drivers/net/mpc5xxx_fec.c                  |    9 +-
 drivers/qe/fdt.c                           |   12 +-
 drivers/qe/qe.c                            |   21 ++--
 examples/standalone/mem_to_mem_idma2intr.c |    4 +-
 include/asm-generic/global_data.h          |  102 ++++++++++++++++++++
 134 files changed, 826 insertions(+), 1028 deletions(-)
 create mode 100644 include/asm-generic/global_data.h

-- 
1.7.7.3

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 01/57] Add architecture-specific global data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 02/57] at91: Move at91 global data into arch_global_data Simon Glass
                   ` (56 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

We plan to move architecture-specific data into a separate structure so
that we can make the rest of it common.

As a first step, create struct arch_global_data to hold these fields.
Initially it is empty.

This patch applies to all archs at once. I can split it if this is really
a pain.


Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/include/asm/global_data.h        |    6 ++++++
 arch/avr32/include/asm/global_data.h      |    5 +++++
 arch/blackfin/include/asm/global_data.h   |    5 +++++
 arch/m68k/include/asm/global_data.h       |    6 ++++++
 arch/microblaze/include/asm/global_data.h |    6 ++++++
 arch/mips/include/asm/global_data.h       |    5 +++++
 arch/nds32/include/asm/global_data.h      |    6 ++++++
 arch/nios2/include/asm/global_data.h      |    5 +++++
 arch/openrisc/include/asm/global_data.h   |    6 ++++++
 arch/powerpc/include/asm/global_data.h    |    5 +++++
 arch/sandbox/include/asm/global_data.h    |    6 ++++++
 arch/sh/include/asm/global_data.h         |    5 +++++
 arch/sparc/include/asm/global_data.h      |    5 +++++
 arch/x86/include/asm/global_data.h        |   10 ++++++++--
 14 files changed, 79 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 2b9af93..8ca45ca 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -23,6 +23,11 @@
 
 #ifndef	__ASM_GBL_DATA_H
 #define __ASM_GBL_DATA_H
+
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory which is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -82,6 +87,7 @@ typedef	struct	global_data {
 	unsigned long	post_log_res; /* success of POST test */
 	unsigned long	post_init_f_time; /* When post_init_f started */
 #endif
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/avr32/include/asm/global_data.h b/arch/avr32/include/asm/global_data.h
index bf661e2..236a9da 100644
--- a/arch/avr32/include/asm/global_data.h
+++ b/arch/avr32/include/asm/global_data.h
@@ -22,6 +22,10 @@
 #ifndef __ASM_GLOBAL_DATA_H__
 #define __ASM_GLOBAL_DATA_H__
 
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -48,6 +52,7 @@ typedef	struct	global_data {
 #endif
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/blackfin/include/asm/global_data.h b/arch/blackfin/include/asm/global_data.h
index d91e5a4..109069f 100644
--- a/arch/blackfin/include/asm/global_data.h
+++ b/arch/blackfin/include/asm/global_data.h
@@ -30,6 +30,10 @@
 
 #include <asm/u-boot.h>
 
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -57,6 +61,7 @@ typedef struct global_data {
 
 	void	**jt;			/* jump table */
 	char	env_buf[32];		/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h
index 0cdb11c..fd8aacb 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -23,6 +23,11 @@
 
 #ifndef	__ASM_GBL_DATA_H
 #define __ASM_GBL_DATA_H
+
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -66,6 +71,7 @@ typedef	struct	global_data {
 #endif
 	void		**jt;		/* Standalone app jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/microblaze/include/asm/global_data.h b/arch/microblaze/include/asm/global_data.h
index 2111c7c..025131c 100644
--- a/arch/microblaze/include/asm/global_data.h
+++ b/arch/microblaze/include/asm/global_data.h
@@ -24,6 +24,11 @@
 
 #ifndef	__ASM_GBL_DATA_H
 #define __ASM_GBL_DATA_H
+
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -46,6 +51,7 @@ typedef	struct	global_data {
 	unsigned long	fb_base;	/* base address of frame buffer */
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h
index a735a8a..99949e1 100644
--- a/arch/mips/include/asm/global_data.h
+++ b/arch/mips/include/asm/global_data.h
@@ -26,6 +26,10 @@
 
 #include <asm/regdef.h>
 
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -59,6 +63,7 @@ typedef	struct	global_data {
 	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/nds32/include/asm/global_data.h b/arch/nds32/include/asm/global_data.h
index b1feb2c..475bb44 100644
--- a/arch/nds32/include/asm/global_data.h
+++ b/arch/nds32/include/asm/global_data.h
@@ -33,6 +33,11 @@
 
 #ifndef	__ASM_GBL_DATA_H
 #define __ASM_GBL_DATA_H
+
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -63,6 +68,7 @@ typedef	struct global_data {
 
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/nios2/include/asm/global_data.h b/arch/nios2/include/asm/global_data.h
index 413b485..cf8597b 100644
--- a/arch/nios2/include/asm/global_data.h
+++ b/arch/nios2/include/asm/global_data.h
@@ -23,6 +23,10 @@
 #ifndef	__ASM_NIOS2_GLOBALDATA_H_
 #define __ASM_NIOS2_GLOBALDATA_H_
 
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 typedef	struct	global_data {
 	bd_t		*bd;
 	unsigned long	flags;
@@ -42,6 +46,7 @@ typedef	struct	global_data {
 #endif
 	void		**jt;		/* Standalone app jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/openrisc/include/asm/global_data.h b/arch/openrisc/include/asm/global_data.h
index 96f3f1c..b478afa 100644
--- a/arch/openrisc/include/asm/global_data.h
+++ b/arch/openrisc/include/asm/global_data.h
@@ -24,6 +24,11 @@
 
 #ifndef __ASM_GBL_DATA_H
 #define __ASM_GBL_DATA_H
+
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -44,6 +49,7 @@ typedef struct global_data {
 	unsigned long	fb_base;	/* base address of frame buffer */
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index cb3a80b..df621da 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -27,6 +27,10 @@
 #include "config.h"
 #include "asm/types.h"
 
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -184,6 +188,7 @@ typedef	struct	global_data {
 #endif
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/sandbox/include/asm/global_data.h b/arch/sandbox/include/asm/global_data.h
index 78a751d..f33f465 100644
--- a/arch/sandbox/include/asm/global_data.h
+++ b/arch/sandbox/include/asm/global_data.h
@@ -25,6 +25,11 @@
 
 #ifndef	__ASM_GBL_DATA_H
 #define __ASM_GBL_DATA_H
+
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -46,6 +51,7 @@ typedef	struct global_data {
 	const void	*fdt_blob;	/* Our device tree, NULL if none */
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/sh/include/asm/global_data.h b/arch/sh/include/asm/global_data.h
index 9a2c193..db85d4d 100644
--- a/arch/sh/include/asm/global_data.h
+++ b/arch/sh/include/asm/global_data.h
@@ -27,6 +27,10 @@
 #ifndef	__ASM_SH_GLOBALDATA_H_
 #define __ASM_SH_GLOBALDATA_H_
 
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 typedef	struct global_data
 {
 	bd_t		*bd;
@@ -42,6 +46,7 @@ typedef	struct global_data
 	unsigned long	env_valid;	/* Checksum of Environment valid */
 	void		**jt;		/* Standalone app jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/sparc/include/asm/global_data.h b/arch/sparc/include/asm/global_data.h
index aa63b35..a51c40b 100644
--- a/arch/sparc/include/asm/global_data.h
+++ b/arch/sparc/include/asm/global_data.h
@@ -29,6 +29,10 @@
 
 #include "asm/types.h"
 
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -74,6 +78,7 @@ typedef struct global_data {
 #endif
 	void	**jt;			/* jump table */
 	char	env_buf[32];		/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index bce999f..b4b749b 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -23,6 +23,13 @@
 
 #ifndef	__ASM_GBL_DATA_H
 #define __ASM_GBL_DATA_H
+
+#ifndef __ASSEMBLY__
+
+/* Architecture-specific global data */
+struct arch_global_data {
+};
+
 /*
  * The following data structure is placed in some memory wich is
  * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
@@ -31,8 +38,6 @@
  * up the memory controller so that we can use RAM).
  */
 
-#ifndef __ASSEMBLY__
-
 typedef	struct global_data {
 	/* NOTE: gd_addr MUST be first member of struct global_data! */
 	unsigned long	gd_addr;	/* Location of Global Data */
@@ -57,6 +62,7 @@ typedef	struct global_data {
 	unsigned long	reset_status;	/* reset status register at boot */
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
 } gd_t;
 
 static inline gd_t *get_fs_gd_ptr(void)
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 02/57] at91: Move at91 global data into arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 01/57] Add architecture-specific global data Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 03/57] arm: Move timer_rate_hz " Simon Glass
                   ` (55 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move these fields into arch_global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/arm920t/at91/clock.c    |   24 +++++++++++++-----------
 arch/arm/cpu/arm926ejs/at91/clock.c  |   30 ++++++++++++++++--------------
 arch/arm/cpu/arm926ejs/at91/timer.c  |    2 +-
 arch/arm/include/asm/arch-at91/clk.h |   12 ++++++------
 arch/arm/include/asm/global_data.h   |   18 +++++++++---------
 5 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/arch/arm/cpu/arm920t/at91/clock.c b/arch/arm/cpu/arm920t/at91/clock.c
index 09d2799..696200d 100644
--- a/arch/arm/cpu/arm920t/at91/clock.c
+++ b/arch/arm/cpu/arm920t/at91/clock.c
@@ -29,11 +29,11 @@ static unsigned long at91_css_to_rate(unsigned long css)
 	case AT91_PMC_MCKR_CSS_SLOW:
 		return CONFIG_SYS_AT91_SLOW_CLOCK;
 	case AT91_PMC_MCKR_CSS_MAIN:
-		return gd->main_clk_rate_hz;
+		return gd->arch.main_clk_rate_hz;
 	case AT91_PMC_MCKR_CSS_PLLA:
-		return gd->plla_rate_hz;
+		return gd->arch.plla_rate_hz;
 	case AT91_PMC_MCKR_CSS_PLLB:
-		return gd->pllb_rate_hz;
+		return gd->arch.pllb_rate_hz;
 	}
 
 	return 0;
@@ -124,10 +124,10 @@ int at91_clock_init(unsigned long main_clock)
 		main_clock = tmp * (CONFIG_SYS_AT91_SLOW_CLOCK / 16);
 	}
 #endif
-	gd->main_clk_rate_hz = main_clock;
+	gd->arch.main_clk_rate_hz = main_clock;
 
 	/* report if PLLA is more than mildly overclocked */
-	gd->plla_rate_hz = at91_pll_rate(main_clock, readl(&pmc->pllar));
+	gd->arch.plla_rate_hz = at91_pll_rate(main_clock, readl(&pmc->pllar));
 
 #ifdef CONFIG_USB_ATMEL
 	/*
@@ -136,9 +136,10 @@ int at91_clock_init(unsigned long main_clock)
 	 *
 	 * REVISIT:  assumes MCK doesn't derive from PLLB!
 	 */
-	gd->at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2) |
+	gd->arch.at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2) |
 			     AT91_PMC_PLLBR_USBDIV_2;
-	gd->pllb_rate_hz = at91_pll_rate(main_clock, gd->at91_pllb_usb_init);
+	gd->arch.pllb_rate_hz = at91_pll_rate(main_clock,
+					      gd->arch.at91_pllb_usb_init);
 #endif
 
 	/*
@@ -146,13 +147,14 @@ int at91_clock_init(unsigned long main_clock)
 	 * For now, assume this parentage won't change.
 	 */
 	mckr = readl(&pmc->mckr);
-	gd->mck_rate_hz = at91_css_to_rate(mckr & AT91_PMC_MCKR_CSS_MASK);
-	freq = gd->mck_rate_hz;
+	gd->arch.mck_rate_hz = at91_css_to_rate(mckr & AT91_PMC_MCKR_CSS_MASK);
+	freq = gd->arch.mck_rate_hz;
 
 	freq /= (1 << ((mckr & AT91_PMC_MCKR_PRES_MASK) >> 2));	/* prescale */
 	/* mdiv */
-	gd->mck_rate_hz = freq / (1 + ((mckr & AT91_PMC_MCKR_MDIV_MASK) >> 8));
-	gd->cpu_clk_rate_hz = freq;
+	gd->arch.mck_rate_hz = freq /
+			(1 + ((mckr & AT91_PMC_MCKR_MDIV_MASK) >> 8));
+	gd->arch.cpu_clk_rate_hz = freq;
 
 	return 0;
 }
diff --git a/arch/arm/cpu/arm926ejs/at91/clock.c b/arch/arm/cpu/arm926ejs/at91/clock.c
index dc5c6c4..f825388 100644
--- a/arch/arm/cpu/arm926ejs/at91/clock.c
+++ b/arch/arm/cpu/arm926ejs/at91/clock.c
@@ -29,11 +29,11 @@ static unsigned long at91_css_to_rate(unsigned long css)
 	case AT91_PMC_MCKR_CSS_SLOW:
 		return CONFIG_SYS_AT91_SLOW_CLOCK;
 	case AT91_PMC_MCKR_CSS_MAIN:
-		return gd->main_clk_rate_hz;
+		return gd->arch.main_clk_rate_hz;
 	case AT91_PMC_MCKR_CSS_PLLA:
-		return gd->plla_rate_hz;
+		return gd->arch.plla_rate_hz;
 	case AT91_PMC_MCKR_CSS_PLLB:
-		return gd->pllb_rate_hz;
+		return gd->arch.pllb_rate_hz;
 	}
 
 	return 0;
@@ -132,10 +132,10 @@ int at91_clock_init(unsigned long main_clock)
 		main_clock = tmp * (CONFIG_SYS_AT91_SLOW_CLOCK / 16);
 	}
 #endif
-	gd->main_clk_rate_hz = main_clock;
+	gd->arch.main_clk_rate_hz = main_clock;
 
 	/* report if PLLA is more than mildly overclocked */
-	gd->plla_rate_hz = at91_pll_rate(main_clock, readl(&pmc->pllar));
+	gd->arch.plla_rate_hz = at91_pll_rate(main_clock, readl(&pmc->pllar));
 
 #ifdef CONFIG_USB_ATMEL
 	/*
@@ -144,9 +144,10 @@ int at91_clock_init(unsigned long main_clock)
 	 *
 	 * REVISIT:  assumes MCK doesn't derive from PLLB!
 	 */
-	gd->at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2) |
+	gd->arch.at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2) |
 			     AT91_PMC_PLLBR_USBDIV_2;
-	gd->pllb_rate_hz = at91_pll_rate(main_clock, gd->at91_pllb_usb_init);
+	gd->arch.pllb_rate_hz = at91_pll_rate(main_clock,
+					      gd->arch.at91_pllb_usb_init);
 #endif
 
 	/*
@@ -157,15 +158,15 @@ int at91_clock_init(unsigned long main_clock)
 #if defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) \
 		|| defined(CONFIG_AT91SAM9X5)
 	/* plla divisor by 2 */
-	gd->plla_rate_hz /= (1 << ((mckr & 1 << 12) >> 12));
+	gd->arch.plla_rate_hz /= (1 << ((mckr & 1 << 12) >> 12));
 #endif
-	gd->mck_rate_hz = at91_css_to_rate(mckr & AT91_PMC_MCKR_CSS_MASK);
-	freq = gd->mck_rate_hz;
+	gd->arch.mck_rate_hz = at91_css_to_rate(mckr & AT91_PMC_MCKR_CSS_MASK);
+	freq = gd->arch.mck_rate_hz;
 
 	freq /= (1 << ((mckr & AT91_PMC_MCKR_PRES_MASK) >> 2));	/* prescale */
 #if defined(CONFIG_AT91SAM9G20)
 	/* mdiv ; (x >> 7) = ((x >> 8) * 2) */
-	gd->mck_rate_hz = (mckr & AT91_PMC_MCKR_MDIV_MASK) ?
+	gd->arch.mck_rate_hz = (mckr & AT91_PMC_MCKR_MDIV_MASK) ?
 		freq / ((mckr & AT91_PMC_MCKR_MDIV_MASK) >> 7) : freq;
 	if (mckr & AT91_PMC_MCKR_MDIV_MASK)
 		freq /= 2;			/* processor clock division */
@@ -177,14 +178,15 @@ int at91_clock_init(unsigned long main_clock)
 	 *  2   <==>   4
 	 *  3   <==>   3
 	 */
-	gd->mck_rate_hz = (mckr & AT91_PMC_MCKR_MDIV_MASK) ==
+	gd->arch.mck_rate_hz = (mckr & AT91_PMC_MCKR_MDIV_MASK) ==
 		(AT91_PMC_MCKR_MDIV_2 | AT91_PMC_MCKR_MDIV_4)
 		? freq / 3
 		: freq / (1 << ((mckr & AT91_PMC_MCKR_MDIV_MASK) >> 8));
 #else
-	gd->mck_rate_hz = freq / (1 << ((mckr & AT91_PMC_MCKR_MDIV_MASK) >> 8));
+	gd->arch.mck_rate_hz = freq /
+			(1 << ((mckr & AT91_PMC_MCKR_MDIV_MASK) >> 8));
 #endif
-	gd->cpu_clk_rate_hz = freq;
+	gd->arch.cpu_clk_rate_hz = freq;
 
 	return 0;
 }
diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c
index f70ce83..641ae3e 100644
--- a/arch/arm/cpu/arm926ejs/at91/timer.c
+++ b/arch/arm/cpu/arm926ejs/at91/timer.c
@@ -79,7 +79,7 @@ int timer_init(void)
 	/* Enable PITC */
 	writel(TIMER_LOAD_VAL | AT91_PIT_MR_EN , &pit->mr);
 
-	gd->timer_rate_hz = gd->mck_rate_hz / 16;
+	gd->timer_rate_hz = gd->arch.mck_rate_hz / 16;
 	gd->tbu = gd->tbl = 0;
 
 	return 0;
diff --git a/arch/arm/include/asm/arch-at91/clk.h b/arch/arm/include/asm/arch-at91/clk.h
index 1e8522b..d4852a3 100644
--- a/arch/arm/include/asm/arch-at91/clk.h
+++ b/arch/arm/include/asm/arch-at91/clk.h
@@ -31,37 +31,37 @@
 static inline unsigned long get_cpu_clk_rate(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
-	return gd->cpu_clk_rate_hz;
+	return gd->arch.cpu_clk_rate_hz;
 }
 
 static inline unsigned long get_main_clk_rate(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
-	return gd->main_clk_rate_hz;
+	return gd->arch.main_clk_rate_hz;
 }
 
 static inline unsigned long get_mck_clk_rate(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
-	return gd->mck_rate_hz;
+	return gd->arch.mck_rate_hz;
 }
 
 static inline unsigned long get_plla_clk_rate(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
-	return gd->plla_rate_hz;
+	return gd->arch.plla_rate_hz;
 }
 
 static inline unsigned long get_pllb_clk_rate(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
-	return gd->pllb_rate_hz;
+	return gd->arch.pllb_rate_hz;
 }
 
 static inline u32 get_pllb_init(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
-	return gd->at91_pllb_usb_init;
+	return gd->arch.at91_pllb_usb_init;
 }
 
 static inline unsigned long get_macb_pclk_rate(unsigned int dev_id)
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 8ca45ca..ba7814a 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -26,6 +26,15 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+#ifdef CONFIG_AT91FAMILY
+	/* "static data" needed by at91's clock.c */
+	unsigned long	cpu_clk_rate_hz;
+	unsigned long	main_clk_rate_hz;
+	unsigned long	mck_rate_hz;
+	unsigned long	plla_rate_hz;
+	unsigned long	pllb_rate_hz;
+	unsigned long	at91_pllb_usb_init;
+#endif
 };
 
 /*
@@ -50,15 +59,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_FSL_ESDHC
 	unsigned long	sdhc_clk;
 #endif
-#ifdef CONFIG_AT91FAMILY
-	/* "static data" needed by at91's clock.c */
-	unsigned long	cpu_clk_rate_hz;
-	unsigned long	main_clk_rate_hz;
-	unsigned long	mck_rate_hz;
-	unsigned long	plla_rate_hz;
-	unsigned long	pllb_rate_hz;
-	unsigned long	at91_pllb_usb_init;
-#endif
 #ifdef CONFIG_ARM
 	/* "static data" needed by most of timer.c on ARM platforms */
 	unsigned long	timer_rate_hz;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 03/57] arm: Move timer_rate_hz into arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 01/57] Add architecture-specific global data Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 02/57] at91: Move at91 global data into arch_global_data Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 04/57] arm: Move tbu to arch_global_data Simon Glass
                   ` (54 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/arm920t/a320/timer.c      |    8 ++++----
 arch/arm/cpu/arm920t/s3c24x0/timer.c   |    4 ++--
 arch/arm/cpu/arm926ejs/at91/timer.c    |    8 ++++----
 arch/arm/cpu/arm926ejs/davinci/timer.c |    9 +++++----
 arch/arm/include/asm/global_data.h     |    3 ++-
 5 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c
index 4bfcef2..2873643 100644
--- a/arch/arm/cpu/arm920t/a320/timer.c
+++ b/arch/arm/cpu/arm920t/a320/timer.c
@@ -31,14 +31,14 @@ DECLARE_GLOBAL_DATA_PTR;
 static inline unsigned long long tick_to_time(unsigned long long tick)
 {
 	tick *= CONFIG_SYS_HZ;
-	do_div(tick, gd->timer_rate_hz);
+	do_div(tick, gd->arch.timer_rate_hz);
 
 	return tick;
 }
 
 static inline unsigned long long usec_to_tick(unsigned long long usec)
 {
-	usec *= gd->timer_rate_hz;
+	usec *= gd->arch.timer_rate_hz;
 	do_div(usec, 1000000);
 
 	return usec;
@@ -74,7 +74,7 @@ int timer_init(void)
 	cr |= FTTMR010_TM3_ENABLE;
 	writel(cr, &tmr->cr);
 
-	gd->timer_rate_hz = TIMER_CLOCK;
+	gd->arch.timer_rate_hz = TIMER_CLOCK;
 	gd->tbu = gd->tbl = 0;
 
 	return 0;
@@ -126,5 +126,5 @@ ulong get_timer(ulong base)
  */
 ulong get_tbclk(void)
 {
-	return gd->timer_rate_hz;
+	return gd->arch.timer_rate_hz;
 }
diff --git a/arch/arm/cpu/arm920t/s3c24x0/timer.c b/arch/arm/cpu/arm920t/s3c24x0/timer.c
index d8668be..7694fea 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/timer.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/timer.c
@@ -52,7 +52,7 @@ int timer_init(void)
 		 * @33.25MHz and 15625 @ 50 MHz
 		 */
 		gd->tbu = get_PCLK() / (2 * 16 * 100);
-		gd->timer_rate_hz = get_PCLK() / (2 * 16);
+		gd->arch.timer_rate_hz = get_PCLK() / (2 * 16);
 	}
 	/* load value for 10 ms timeout */
 	writel(gd->tbu, &timers->tcntb4);
@@ -93,7 +93,7 @@ ulong get_timer_masked(void)
 {
 	ulong tmr = get_ticks();
 
-	return tmr / (gd->timer_rate_hz / CONFIG_SYS_HZ);
+	return tmr / (gd->arch.timer_rate_hz / CONFIG_SYS_HZ);
 }
 
 void udelay_masked(unsigned long usec)
diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c
index 641ae3e..061ccaf 100644
--- a/arch/arm/cpu/arm926ejs/at91/timer.c
+++ b/arch/arm/cpu/arm926ejs/at91/timer.c
@@ -52,14 +52,14 @@ DECLARE_GLOBAL_DATA_PTR;
 static inline unsigned long long tick_to_time(unsigned long long tick)
 {
 	tick *= CONFIG_SYS_HZ;
-	do_div(tick, gd->timer_rate_hz);
+	do_div(tick, gd->arch.timer_rate_hz);
 
 	return tick;
 }
 
 static inline unsigned long long usec_to_tick(unsigned long long usec)
 {
-	usec *= gd->timer_rate_hz;
+	usec *= gd->arch.timer_rate_hz;
 	do_div(usec, 1000000);
 
 	return usec;
@@ -79,7 +79,7 @@ int timer_init(void)
 	/* Enable PITC */
 	writel(TIMER_LOAD_VAL | AT91_PIT_MR_EN , &pit->mr);
 
-	gd->timer_rate_hz = gd->arch.mck_rate_hz / 16;
+	gd->arch.timer_rate_hz = gd->arch.mck_rate_hz / 16;
 	gd->tbu = gd->tbl = 0;
 
 	return 0;
@@ -132,5 +132,5 @@ ulong get_timer(ulong base)
  */
 ulong get_tbclk(void)
 {
-	return gd->timer_rate_hz;
+	return gd->arch.timer_rate_hz;
 }
diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c
index 93c9e60..7e852b5 100644
--- a/arch/arm/cpu/arm926ejs/davinci/timer.c
+++ b/arch/arm/cpu/arm926ejs/davinci/timer.c
@@ -60,7 +60,7 @@ int timer_init(void)
 	writel(0x0, &timer->tim34);
 	writel(TIMER_LOAD_VAL, &timer->prd34);
 	writel(2 << 22, &timer->tcr);
-	gd->timer_rate_hz = CONFIG_SYS_HZ_CLOCK / TIM_CLK_DIV;
+	gd->arch.timer_rate_hz = CONFIG_SYS_HZ_CLOCK / TIM_CLK_DIV;
 	gd->timer_reset_value = 0;
 
 	return(0);
@@ -87,14 +87,15 @@ ulong get_timer(ulong base)
 
 	timer_diff = get_ticks() - gd->timer_reset_value;
 
-	return lldiv(timer_diff, (gd->timer_rate_hz / CONFIG_SYS_HZ)) - base;
+	return lldiv(timer_diff,
+		     (gd->arch.timer_rate_hz / CONFIG_SYS_HZ)) - base;
 }
 
 void __udelay(unsigned long usec)
 {
 	unsigned long long endtime;
 
-	endtime = lldiv((unsigned long long)usec * gd->timer_rate_hz,
+	endtime = lldiv((unsigned long long)usec * gd->arch.timer_rate_hz,
 			1000000UL);
 	endtime += get_ticks();
 
@@ -108,7 +109,7 @@ void __udelay(unsigned long usec)
  */
 ulong get_tbclk(void)
 {
-	return gd->timer_rate_hz;
+	return gd->arch.timer_rate_hz;
 }
 
 #ifdef CONFIG_HW_WATCHDOG
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index ba7814a..7a2f644 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -35,6 +35,8 @@ struct arch_global_data {
 	unsigned long	pllb_rate_hz;
 	unsigned long	at91_pllb_usb_init;
 #endif
+	/* "static data" needed by most of timer.c on ARM platforms */
+	unsigned long timer_rate_hz;
 };
 
 /*
@@ -61,7 +63,6 @@ typedef	struct	global_data {
 #endif
 #ifdef CONFIG_ARM
 	/* "static data" needed by most of timer.c on ARM platforms */
-	unsigned long	timer_rate_hz;
 	unsigned long	tbl;
 	unsigned long	tbu;
 	unsigned long long	timer_reset_value;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 04/57] arm: Move tbu to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (2 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 03/57] arm: Move timer_rate_hz " Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 05/57] arm: Move tbl " Simon Glass
                   ` (53 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/arm920t/a320/timer.c        |    6 +++---
 arch/arm/cpu/arm920t/s3c24x0/timer.c     |   14 +++++++-------
 arch/arm/cpu/arm926ejs/armada100/timer.c |   12 ++++++------
 arch/arm/cpu/arm926ejs/at91/timer.c      |    6 +++---
 arch/arm/cpu/arm926ejs/davinci/timer.c   |    4 ++--
 arch/arm/cpu/arm926ejs/pantheon/timer.c  |   12 ++++++------
 arch/arm/cpu/armv7/u8500/timer.c         |    2 +-
 arch/arm/include/asm/global_data.h       |    2 +-
 8 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c
index 2873643..781533b 100644
--- a/arch/arm/cpu/arm920t/a320/timer.c
+++ b/arch/arm/cpu/arm920t/a320/timer.c
@@ -75,7 +75,7 @@ int timer_init(void)
 	writel(cr, &tmr->cr);
 
 	gd->arch.timer_rate_hz = TIMER_CLOCK;
-	gd->tbu = gd->tbl = 0;
+	gd->arch.tbu = gd->tbl = 0;
 
 	return 0;
 }
@@ -90,9 +90,9 @@ unsigned long long get_ticks(void)
 
 	/* increment tbu if tbl has rolled over */
 	if (now < gd->tbl)
-		gd->tbu++;
+		gd->arch.tbu++;
 	gd->tbl = now;
-	return (((unsigned long long)gd->tbu) << 32) | gd->tbl;
+	return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl;
 }
 
 void __udelay(unsigned long usec)
diff --git a/arch/arm/cpu/arm920t/s3c24x0/timer.c b/arch/arm/cpu/arm920t/s3c24x0/timer.c
index 7694fea..e59e614 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/timer.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/timer.c
@@ -45,17 +45,17 @@ int timer_init(void)
 	/* use PWM Timer 4 because it has no output */
 	/* prescaler for Timer 4 is 16 */
 	writel(0x0f00, &timers->tcfg0);
-	if (gd->tbu == 0) {
+	if (gd->arch.tbu == 0) {
 		/*
 		 * for 10 ms clock period @ PCLK with 4 bit divider = 1/2
 		 * (default) and prescaler = 16. Should be 10390
 		 * @33.25MHz and 15625 @ 50 MHz
 		 */
-		gd->tbu = get_PCLK() / (2 * 16 * 100);
+		gd->arch.tbu = get_PCLK() / (2 * 16 * 100);
 		gd->arch.timer_rate_hz = get_PCLK() / (2 * 16);
 	}
 	/* load value for 10 ms timeout */
-	writel(gd->tbu, &timers->tcntb4);
+	writel(gd->arch.tbu, &timers->tcntb4);
 	/* auto load, manual update of timer 4 */
 	tmr = (readl(&timers->tcon) & ~0x0700000) | 0x0600000;
 	writel(tmr, &timers->tcon);
@@ -82,7 +82,7 @@ void __udelay (unsigned long usec)
 	ulong start = get_ticks();
 
 	tmo = usec / 1000;
-	tmo *= (gd->tbu * 100);
+	tmo *= (gd->arch.tbu * 100);
 	tmo /= 1000;
 
 	while ((ulong) (get_ticks() - start) < tmo)
@@ -104,10 +104,10 @@ void udelay_masked(unsigned long usec)
 
 	if (usec >= 1000) {
 		tmo = usec / 1000;
-		tmo *= (gd->tbu * 100);
+		tmo *= (gd->arch.tbu * 100);
 		tmo /= 1000;
 	} else {
-		tmo = usec * (gd->tbu * 100);
+		tmo = usec * (gd->arch.tbu * 100);
 		tmo /= (1000 * 1000);
 	}
 
@@ -133,7 +133,7 @@ unsigned long long get_ticks(void)
 		gd->tbl += gd->lastinc - now;
 	} else {
 		/* we have an overflow ... */
-		gd->tbl += gd->lastinc + gd->tbu - now;
+		gd->tbl += gd->lastinc + gd->arch.tbu - now;
 	}
 	gd->lastinc = now;
 
diff --git a/arch/arm/cpu/arm926ejs/armada100/timer.c b/arch/arm/cpu/arm926ejs/armada100/timer.c
index 355cd6d..18ffd0c 100644
--- a/arch/arm/cpu/arm926ejs/armada100/timer.c
+++ b/arch/arm/cpu/arm926ejs/armada100/timer.c
@@ -61,7 +61,7 @@ struct armd1tmr_registers {
 #define	COUNT_RD_REQ		0x1
 
 DECLARE_GLOBAL_DATA_PTR;
-/* Using gd->tbu from timestamp and gd->tbl for lastdec */
+/* Using gd->arch.tbu from timestamp and gd->tbl for lastdec */
 
 /* For preventing risk of instability in reading counter value,
  * first set read request to register cvwr and then read same
@@ -84,14 +84,14 @@ ulong get_timer_masked(void)
 
 	if (now >= gd->tbl) {
 		/* normal mode */
-		gd->tbu += now - gd->tbl;
+		gd->arch.tbu += now - gd->tbl;
 	} else {
 		/* we have an overflow ... */
-		gd->tbu += now + TIMER_LOAD_VAL - gd->tbl;
+		gd->arch.tbu += now + TIMER_LOAD_VAL - gd->tbl;
 	}
 	gd->tbl = now;
 
-	return gd->tbu;
+	return gd->arch.tbu;
 }
 
 ulong get_timer(ulong base)
@@ -135,9 +135,9 @@ int timer_init(void)
 
 	/* Enable timer 0 */
 	writel(0x1, &armd1timers->cer);
-	/* init the gd->tbu and gd->tbl value */
+	/* init the gd->arch.tbu and gd->tbl value */
 	gd->tbl = read_timer();
-	gd->tbu = 0;
+	gd->arch.tbu = 0;
 
 	return 0;
 }
diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c
index 061ccaf..f691518 100644
--- a/arch/arm/cpu/arm926ejs/at91/timer.c
+++ b/arch/arm/cpu/arm926ejs/at91/timer.c
@@ -80,7 +80,7 @@ int timer_init(void)
 	writel(TIMER_LOAD_VAL | AT91_PIT_MR_EN , &pit->mr);
 
 	gd->arch.timer_rate_hz = gd->arch.mck_rate_hz / 16;
-	gd->tbu = gd->tbl = 0;
+	gd->arch.tbu = gd->tbl = 0;
 
 	return 0;
 }
@@ -96,9 +96,9 @@ unsigned long long get_ticks(void)
 
 	/* increment tbu if tbl has rolled over */
 	if (now < gd->tbl)
-		gd->tbu++;
+		gd->arch.tbu++;
 	gd->tbl = now;
-	return (((unsigned long long)gd->tbu) << 32) | gd->tbl;
+	return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl;
 }
 
 void __udelay(unsigned long usec)
diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c
index 7e852b5..e28e6e3 100644
--- a/arch/arm/cpu/arm926ejs/davinci/timer.c
+++ b/arch/arm/cpu/arm926ejs/davinci/timer.c
@@ -75,10 +75,10 @@ unsigned long long get_ticks(void)
 
 	/* increment tbu if tbl has rolled over */
 	if (now < gd->tbl)
-		gd->tbu++;
+		gd->arch.tbu++;
 	gd->tbl = now;
 
-	return (((unsigned long long)gd->tbu) << 32) | gd->tbl;
+	return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl;
 }
 
 ulong get_timer(ulong base)
diff --git a/arch/arm/cpu/arm926ejs/pantheon/timer.c b/arch/arm/cpu/arm926ejs/pantheon/timer.c
index 28aadad..701d439 100644
--- a/arch/arm/cpu/arm926ejs/pantheon/timer.c
+++ b/arch/arm/cpu/arm926ejs/pantheon/timer.c
@@ -60,7 +60,7 @@ struct panthtmr_registers {
 #define	COUNT_RD_REQ		0x1
 
 DECLARE_GLOBAL_DATA_PTR;
-/* Using gd->tbu from timestamp and gd->tbl for lastdec */
+/* Using gd->arch.tbu from timestamp and gd->tbl for lastdec */
 
 /*
  * For preventing risk of instability in reading counter value,
@@ -92,14 +92,14 @@ ulong get_timer_masked(void)
 
 	if (now >= gd->tbl) {
 		/* normal mode */
-		gd->tbu += now - gd->tbl;
+		gd->arch.tbu += now - gd->tbl;
 	} else {
 		/* we have an overflow ... */
-		gd->tbu += now + TIMER_LOAD_VAL - gd->tbl;
+		gd->arch.tbu += now + TIMER_LOAD_VAL - gd->tbl;
 	}
 	gd->tbl = now;
 
-	return gd->tbu;
+	return gd->arch.tbu;
 }
 
 ulong get_timer(ulong base)
@@ -144,9 +144,9 @@ int timer_init(void)
 
 	/* Enable timer 0 */
 	writel(0x1, &panthtimers->cer);
-	/* init the gd->tbu and gd->tbl value */
+	/* init the gd->arch.tbu and gd->tbl value */
 	gd->tbl = read_timer();
-	gd->tbu = 0;
+	gd->arch.tbu = 0;
 
 	return 0;
 }
diff --git a/arch/arm/cpu/armv7/u8500/timer.c b/arch/arm/cpu/armv7/u8500/timer.c
index 79aad99..bb9165b 100644
--- a/arch/arm/cpu/armv7/u8500/timer.c
+++ b/arch/arm/cpu/armv7/u8500/timer.c
@@ -132,7 +132,7 @@ ulong get_timer(ulong base)
 /*
  * Emulation of Power architecture long long timebase.
  *
- * TODO: Support gd->tbu for real long long timebase.
+ * TODO: Support gd->arch.tbu for real long long timebase.
  */
 unsigned long long get_ticks(void)
 {
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 7a2f644..5d37061 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -37,6 +37,7 @@ struct arch_global_data {
 #endif
 	/* "static data" needed by most of timer.c on ARM platforms */
 	unsigned long timer_rate_hz;
+	unsigned long tbu;
 };
 
 /*
@@ -64,7 +65,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_ARM
 	/* "static data" needed by most of timer.c on ARM platforms */
 	unsigned long	tbl;
-	unsigned long	tbu;
 	unsigned long long	timer_reset_value;
 	unsigned long	lastinc;
 #endif
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 05/57] arm: Move tbl to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (3 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 04/57] arm: Move tbu to arch_global_data Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 06/57] arm: Move lastinc " Simon Glass
                   ` (52 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/arm1136/mx31/timer.c        |    6 +++---
 arch/arm/cpu/arm1136/mx35/timer.c        |    2 +-
 arch/arm/cpu/arm1136/omap24xx/timer.c    |   17 ++++++++++-------
 arch/arm/cpu/arm920t/a320/timer.c        |    8 ++++----
 arch/arm/cpu/arm920t/at91/timer.c        |    8 ++++----
 arch/arm/cpu/arm920t/s3c24x0/timer.c     |    8 ++++----
 arch/arm/cpu/arm926ejs/armada100/timer.c |   14 +++++++-------
 arch/arm/cpu/arm926ejs/at91/timer.c      |    8 ++++----
 arch/arm/cpu/arm926ejs/davinci/timer.c   |    6 +++---
 arch/arm/cpu/arm926ejs/kirkwood/timer.c  |    2 +-
 arch/arm/cpu/arm926ejs/mb86r0x/timer.c   |    2 +-
 arch/arm/cpu/arm926ejs/mx25/timer.c      |    2 +-
 arch/arm/cpu/arm926ejs/mx27/timer.c      |    2 +-
 arch/arm/cpu/arm926ejs/mxs/timer.c       |    2 +-
 arch/arm/cpu/arm926ejs/omap/timer.c      |    2 +-
 arch/arm/cpu/arm926ejs/orion5x/timer.c   |    2 +-
 arch/arm/cpu/arm926ejs/pantheon/timer.c  |   14 +++++++-------
 arch/arm/cpu/arm926ejs/spear/timer.c     |    2 +-
 arch/arm/cpu/arm926ejs/versatile/timer.c |    2 +-
 arch/arm/cpu/armv7/omap-common/timer.c   |   15 ++++++++-------
 arch/arm/cpu/armv7/s5p-common/timer.c    |    8 ++++----
 arch/arm/cpu/armv7/socfpga/timer.c       |    8 ++++----
 arch/arm/cpu/armv7/u8500/timer.c         |   12 +++++++-----
 arch/arm/cpu/armv7/zynq/timer.c          |    8 ++++----
 arch/arm/cpu/pxa/timer.c                 |    2 +-
 arch/arm/cpu/tegra-common/timer.c        |    6 +++---
 arch/arm/imx-common/timer.c              |    2 +-
 arch/arm/include/asm/global_data.h       |    2 +-
 arch/mips/cpu/xburst/timer.c             |   12 ++++++------
 29 files changed, 95 insertions(+), 89 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/timer.c b/arch/arm/cpu/arm1136/mx31/timer.c
index 36266da..7a377cc 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -117,11 +117,11 @@ unsigned long long get_ticks(void)
 
 	if (now >= gd->lastinc)	/* normal mode (non roll) */
 		/* move stamp forward with absolut diff ticks */
-		gd->tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->lastinc);
 	else			/* we have rollover of incrementer */
-		gd->tbl += (0xFFFFFFFF - gd->lastinc) + now;
+		gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now;
 	gd->lastinc = now;
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 ulong get_timer_masked(void)
diff --git a/arch/arm/cpu/arm1136/mx35/timer.c b/arch/arm/cpu/arm1136/mx35/timer.c
index 9680b7f..c21ca3f 100644
--- a/arch/arm/cpu/arm1136/mx35/timer.c
+++ b/arch/arm/cpu/arm1136/mx35/timer.c
@@ -32,7 +32,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp	(gd->tbl)
+#define timestamp	(gd->arch.tbl)
 #define lastinc		(gd->lastinc)
 
 /* General purpose timers bitfields */
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c b/arch/arm/cpu/arm1136/omap24xx/timer.c
index e929ae4..e179bb5 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -52,7 +52,7 @@ int timer_init (void)
 
 	/* reset time */
 	gd->lastinc = READ_TIMER;	/* capture current incrementer value */
-	gd->tbl = 0;			/* start "advancing" time stamp */
+	gd->arch.tbl = 0;		/* start "advancing" time stamp */
 
 	return(0);
 }
@@ -82,7 +82,7 @@ void __udelay (unsigned long usec)
 	if ((tmo + tmp + 1) < tmp) {	/* if setting this forward will roll */
 					/* time stamp, then reset time */
 		gd->lastinc = READ_TIMER;	/* capture incrementer value */
-		gd->tbl = 0;			/* start time stamp */
+		gd->arch.tbl = 0;			/* start time stamp */
 	} else {
 		tmo	+= tmp;		/* else, set advancing stamp wake up time */
 	}
@@ -94,12 +94,15 @@ ulong get_timer_masked (void)
 {
 	ulong now = READ_TIMER;		/* current tick value */
 
-	if (now >= gd->lastinc)		/* normal mode (non roll) */
-		gd->tbl += (now - gd->lastinc); /* move stamp fordward with absoulte diff ticks */
-	else				/* we have rollover of incrementer */
-		gd->tbl += (0xFFFFFFFF - gd->lastinc) + now;
+	if (now >= gd->lastinc) {		/* normal mode (non roll) */
+		/* move stamp fordward with absoulte diff ticks */
+		gd->arch.tbl += (now - gd->lastinc);
+	} else {
+		/* we have rollover of incrementer */
+		gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now;
+	}
 	gd->lastinc = now;
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 /* waits specified delay value and resets timestamp */
diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c
index 781533b..512fb9d 100644
--- a/arch/arm/cpu/arm920t/a320/timer.c
+++ b/arch/arm/cpu/arm920t/a320/timer.c
@@ -75,7 +75,7 @@ int timer_init(void)
 	writel(cr, &tmr->cr);
 
 	gd->arch.timer_rate_hz = TIMER_CLOCK;
-	gd->arch.tbu = gd->tbl = 0;
+	gd->arch.tbu = gd->arch.tbl = 0;
 
 	return 0;
 }
@@ -89,10 +89,10 @@ unsigned long long get_ticks(void)
 	ulong now = TIMER_LOAD_VAL - readl(&tmr->timer3_counter);
 
 	/* increment tbu if tbl has rolled over */
-	if (now < gd->tbl)
+	if (now < gd->arch.tbl)
 		gd->arch.tbu++;
-	gd->tbl = now;
-	return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl;
+	gd->arch.tbl = now;
+	return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl;
 }
 
 void __udelay(unsigned long usec)
diff --git a/arch/arm/cpu/arm920t/at91/timer.c b/arch/arm/cpu/arm920t/at91/timer.c
index 91607b5..439ceab 100644
--- a/arch/arm/cpu/arm920t/at91/timer.c
+++ b/arch/arm/cpu/arm920t/at91/timer.c
@@ -64,7 +64,7 @@ int timer_init(void)
 
 	writel(AT91_TC_CCR_SWTRG | AT91_TC_CCR_CLKEN, &tc->tc[0].ccr);
 	gd->lastinc = 0;
-	gd->tbl = 0;
+	gd->arch.tbl = 0;
 
 	return 0;
 }
@@ -91,14 +91,14 @@ ulong get_timer_raw(void)
 
 	if (now >= gd->lastinc) {
 		/* normal mode */
-		gd->tbl += now - gd->lastinc;
+		gd->arch.tbl += now - gd->lastinc;
 	} else {
 		/* we have an overflow ... */
-		gd->tbl += now + TIMER_LOAD_VAL - gd->lastinc;
+		gd->arch.tbl += now + TIMER_LOAD_VAL - gd->lastinc;
 	}
 	gd->lastinc = now;
 
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 ulong get_timer_masked(void)
diff --git a/arch/arm/cpu/arm920t/s3c24x0/timer.c b/arch/arm/cpu/arm920t/s3c24x0/timer.c
index e59e614..eb2b8d0 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/timer.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/timer.c
@@ -63,7 +63,7 @@ int timer_init(void)
 	tmr = (tmr & ~0x0700000) | 0x0500000;
 	writel(tmr, &timers->tcon);
 	gd->lastinc = 0;
-	gd->tbl = 0;
+	gd->arch.tbl = 0;
 
 	return 0;
 }
@@ -130,14 +130,14 @@ unsigned long long get_ticks(void)
 
 	if (gd->lastinc >= now) {
 		/* normal mode */
-		gd->tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->lastinc - now;
 	} else {
 		/* we have an overflow ... */
-		gd->tbl += gd->lastinc + gd->arch.tbu - now;
+		gd->arch.tbl += gd->lastinc + gd->arch.tbu - now;
 	}
 	gd->lastinc = now;
 
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 /*
diff --git a/arch/arm/cpu/arm926ejs/armada100/timer.c b/arch/arm/cpu/arm926ejs/armada100/timer.c
index 18ffd0c..948607f 100644
--- a/arch/arm/cpu/arm926ejs/armada100/timer.c
+++ b/arch/arm/cpu/arm926ejs/armada100/timer.c
@@ -61,7 +61,7 @@ struct armd1tmr_registers {
 #define	COUNT_RD_REQ		0x1
 
 DECLARE_GLOBAL_DATA_PTR;
-/* Using gd->arch.tbu from timestamp and gd->tbl for lastdec */
+/* Using gd->arch.tbu from timestamp and gd->arch.tbl for lastdec */
 
 /* For preventing risk of instability in reading counter value,
  * first set read request to register cvwr and then read same
@@ -82,14 +82,14 @@ ulong get_timer_masked(void)
 {
 	ulong now = read_timer();
 
-	if (now >= gd->tbl) {
+	if (now >= gd->arch.tbl) {
 		/* normal mode */
-		gd->arch.tbu += now - gd->tbl;
+		gd->arch.tbu += now - gd->arch.tbl;
 	} else {
 		/* we have an overflow ... */
-		gd->arch.tbu += now + TIMER_LOAD_VAL - gd->tbl;
+		gd->arch.tbu += now + TIMER_LOAD_VAL - gd->arch.tbl;
 	}
-	gd->tbl = now;
+	gd->arch.tbl = now;
 
 	return gd->arch.tbu;
 }
@@ -135,8 +135,8 @@ int timer_init(void)
 
 	/* Enable timer 0 */
 	writel(0x1, &armd1timers->cer);
-	/* init the gd->arch.tbu and gd->tbl value */
-	gd->tbl = read_timer();
+	/* init the gd->arch.tbu and gd->arch.tbl value */
+	gd->arch.tbl = read_timer();
 	gd->arch.tbu = 0;
 
 	return 0;
diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c
index f691518..4443fef 100644
--- a/arch/arm/cpu/arm926ejs/at91/timer.c
+++ b/arch/arm/cpu/arm926ejs/at91/timer.c
@@ -80,7 +80,7 @@ int timer_init(void)
 	writel(TIMER_LOAD_VAL | AT91_PIT_MR_EN , &pit->mr);
 
 	gd->arch.timer_rate_hz = gd->arch.mck_rate_hz / 16;
-	gd->arch.tbu = gd->tbl = 0;
+	gd->arch.tbu = gd->arch.tbl = 0;
 
 	return 0;
 }
@@ -95,10 +95,10 @@ unsigned long long get_ticks(void)
 	ulong now = readl(&pit->piir);
 
 	/* increment tbu if tbl has rolled over */
-	if (now < gd->tbl)
+	if (now < gd->arch.tbl)
 		gd->arch.tbu++;
-	gd->tbl = now;
-	return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl;
+	gd->arch.tbl = now;
+	return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl;
 }
 
 void __udelay(unsigned long usec)
diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c
index e28e6e3..b620bf7 100644
--- a/arch/arm/cpu/arm926ejs/davinci/timer.c
+++ b/arch/arm/cpu/arm926ejs/davinci/timer.c
@@ -74,11 +74,11 @@ unsigned long long get_ticks(void)
 	unsigned long now = readl(&timer->tim34);
 
 	/* increment tbu if tbl has rolled over */
-	if (now < gd->tbl)
+	if (now < gd->arch.tbl)
 		gd->arch.tbu++;
-	gd->tbl = now;
+	gd->arch.tbl = now;
 
-	return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl;
+	return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl;
 }
 
 ulong get_timer(ulong base)
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/timer.c b/arch/arm/cpu/arm926ejs/kirkwood/timer.c
index f5d0160..41dc074 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/timer.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/timer.c
@@ -86,7 +86,7 @@ struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers *)KW_TIMER_BASE;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp gd->tbl
+#define timestamp gd->arch.tbl
 #define lastdec gd->lastinc
 
 ulong get_timer_masked(void)
diff --git a/arch/arm/cpu/arm926ejs/mb86r0x/timer.c b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
index 75314b9..1f1900e 100644
--- a/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
+++ b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
@@ -35,7 +35,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp gd->tbl
+#define timestamp gd->arch.tbl
 #define lastdec gd->lastinc
 
 static inline unsigned long long tick_to_time(unsigned long long tick)
diff --git a/arch/arm/cpu/arm926ejs/mx25/timer.c b/arch/arm/cpu/arm926ejs/mx25/timer.c
index 4dc4041..8b5217f 100644
--- a/arch/arm/cpu/arm926ejs/mx25/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx25/timer.c
@@ -44,7 +44,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp	(gd->tbl)
+#define timestamp	(gd->arch.tbl)
 #define lastinc		(gd->lastinc)
 
 /*
diff --git a/arch/arm/cpu/arm926ejs/mx27/timer.c b/arch/arm/cpu/arm926ejs/mx27/timer.c
index a5dd684..06e3086 100644
--- a/arch/arm/cpu/arm926ejs/mx27/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx27/timer.c
@@ -45,7 +45,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp	(gd->tbl)
+#define timestamp	(gd->arch.tbl)
 #define lastinc		(gd->lastinc)
 
 /*
diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c b/arch/arm/cpu/arm926ejs/mxs/timer.c
index 4ed75e6..a12a7e3 100644
--- a/arch/arm/cpu/arm926ejs/mxs/timer.c
+++ b/arch/arm/cpu/arm926ejs/mxs/timer.c
@@ -36,7 +36,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp (gd->tbl)
+#define timestamp (gd->arch.tbl)
 #define lastdec (gd->lastinc)
 
 /*
diff --git a/arch/arm/cpu/arm926ejs/omap/timer.c b/arch/arm/cpu/arm926ejs/omap/timer.c
index 390c9c8..71b8700 100644
--- a/arch/arm/cpu/arm926ejs/omap/timer.c
+++ b/arch/arm/cpu/arm926ejs/omap/timer.c
@@ -44,7 +44,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp gd->tbl
+#define timestamp gd->arch.tbl
 #define lastdec gd->lastinc
 
 int timer_init (void)
diff --git a/arch/arm/cpu/arm926ejs/orion5x/timer.c b/arch/arm/cpu/arm926ejs/orion5x/timer.c
index 8a8aaf1..f69af71 100644
--- a/arch/arm/cpu/arm926ejs/orion5x/timer.c
+++ b/arch/arm/cpu/arm926ejs/orion5x/timer.c
@@ -92,7 +92,7 @@ static inline ulong read_timer(void)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp gd->tbl
+#define timestamp gd->arch.tbl
 #define lastdec gd->lastinc
 
 ulong get_timer_masked(void)
diff --git a/arch/arm/cpu/arm926ejs/pantheon/timer.c b/arch/arm/cpu/arm926ejs/pantheon/timer.c
index 701d439..2d9ddba 100644
--- a/arch/arm/cpu/arm926ejs/pantheon/timer.c
+++ b/arch/arm/cpu/arm926ejs/pantheon/timer.c
@@ -60,7 +60,7 @@ struct panthtmr_registers {
 #define	COUNT_RD_REQ		0x1
 
 DECLARE_GLOBAL_DATA_PTR;
-/* Using gd->arch.tbu from timestamp and gd->tbl for lastdec */
+/* Using gd->arch.tbu from timestamp and gd->arch.tbl for lastdec */
 
 /*
  * For preventing risk of instability in reading counter value,
@@ -90,14 +90,14 @@ ulong get_timer_masked(void)
 {
 	ulong now = read_timer();
 
-	if (now >= gd->tbl) {
+	if (now >= gd->arch.tbl) {
 		/* normal mode */
-		gd->arch.tbu += now - gd->tbl;
+		gd->arch.tbu += now - gd->arch.tbl;
 	} else {
 		/* we have an overflow ... */
-		gd->arch.tbu += now + TIMER_LOAD_VAL - gd->tbl;
+		gd->arch.tbu += now + TIMER_LOAD_VAL - gd->arch.tbl;
 	}
-	gd->tbl = now;
+	gd->arch.tbl = now;
 
 	return gd->arch.tbu;
 }
@@ -144,8 +144,8 @@ int timer_init(void)
 
 	/* Enable timer 0 */
 	writel(0x1, &panthtimers->cer);
-	/* init the gd->arch.tbu and gd->tbl value */
-	gd->tbl = read_timer();
+	/* init the gd->arch.tbu and gd->arch.tbl value */
+	gd->arch.tbl = read_timer();
 	gd->arch.tbu = 0;
 
 	return 0;
diff --git a/arch/arm/cpu/arm926ejs/spear/timer.c b/arch/arm/cpu/arm926ejs/spear/timer.c
index 1dc7860..06ea65b 100644
--- a/arch/arm/cpu/arm926ejs/spear/timer.c
+++ b/arch/arm/cpu/arm926ejs/spear/timer.c
@@ -38,7 +38,7 @@ static struct misc_regs *const misc_regs_p =
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp gd->tbl
+#define timestamp gd->arch.tbl
 #define lastdec gd->lastinc
 
 int timer_init(void)
diff --git a/arch/arm/cpu/arm926ejs/versatile/timer.c b/arch/arm/cpu/arm926ejs/versatile/timer.c
index f58e151..be73b93 100644
--- a/arch/arm/cpu/arm926ejs/versatile/timer.c
+++ b/arch/arm/cpu/arm926ejs/versatile/timer.c
@@ -44,7 +44,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp gd->tbl
+#define timestamp gd->arch.tbl
 #define lastdec gd->lastinc
 
 #define TIMER_ENABLE	(1 << 7)
diff --git a/arch/arm/cpu/armv7/omap-common/timer.c b/arch/arm/cpu/armv7/omap-common/timer.c
index 9f8bc93..e321d53 100644
--- a/arch/arm/cpu/armv7/omap-common/timer.c
+++ b/arch/arm/cpu/armv7/omap-common/timer.c
@@ -57,7 +57,7 @@ int timer_init(void)
 
 	/* reset time, capture current incrementer value time */
 	gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
-	gd->tbl = 0;		/* start "advancing" time stamp from 0 */
+	gd->arch.tbl = 0;	/* start "advancing" time stamp from 0 */
 
 	return 0;
 }
@@ -91,14 +91,15 @@ ulong get_timer_masked(void)
 	/* current tick value */
 	ulong now = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
 
-	if (now >= gd->lastinc)	/* normal mode (non roll) */
+	if (now >= gd->lastinc) {	/* normal mode (non roll) */
 		/* move stamp fordward with absoulte diff ticks */
-		gd->tbl += (now - gd->lastinc);
-	else	/* we have rollover of incrementer */
-		gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK / CONFIG_SYS_HZ))
-			     - gd->lastinc) + now;
+		gd->arch.tbl += (now - gd->lastinc);
+	} else {	/* we have rollover of incrementer */
+		gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK /
+				CONFIG_SYS_HZ)) - gd->lastinc) + now;
+	}
 	gd->lastinc = now;
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 /*
diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c
index bb0e795..1566226 100644
--- a/arch/arm/cpu/armv7/s5p-common/timer.c
+++ b/arch/arm/cpu/armv7/s5p-common/timer.c
@@ -106,7 +106,7 @@ void reset_timer_masked(void)
 
 	/* reset time */
 	gd->lastinc = readl(&timer->tcnto4);
-	gd->tbl = 0;
+	gd->arch.tbl = 0;
 }
 
 unsigned long get_timer_masked(void)
@@ -124,13 +124,13 @@ unsigned long get_current_tick(void)
 	unsigned long count_value = readl(&timer->tcntb4);
 
 	if (gd->lastinc >= now)
-		gd->tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->lastinc - now;
 	else
-		gd->tbl += gd->lastinc + count_value - now;
+		gd->arch.tbl += gd->lastinc + count_value - now;
 
 	gd->lastinc = now;
 
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 /*
diff --git a/arch/arm/cpu/armv7/socfpga/timer.c b/arch/arm/cpu/armv7/socfpga/timer.c
index 321e9b4..a742121 100644
--- a/arch/arm/cpu/armv7/socfpga/timer.c
+++ b/arch/arm/cpu/armv7/socfpga/timer.c
@@ -83,13 +83,13 @@ ulong get_timer_masked(void)
 	if (gd->lastinc >= now) {
 		/* normal mode (non roll) */
 		/* move stamp forward with absolute diff ticks */
-		gd->tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->lastinc - now;
 	} else {
 		/* we have overflow of the count down timer */
-		gd->tbl += TIMER_LOAD_VAL - gd->lastinc + now;
+		gd->arch.tbl += TIMER_LOAD_VAL - gd->lastinc + now;
 	}
 	gd->lastinc = now;
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 /*
@@ -100,5 +100,5 @@ void reset_timer(void)
 	/* capture current decrementer value time */
 	gd->lastinc = read_timer() / (CONFIG_TIMER_CLOCK_KHZ/CONFIG_SYS_HZ);
 	/* start "advancing" time stamp from 0 */
-	gd->tbl = 0;
+	gd->arch.tbl = 0;
 }
diff --git a/arch/arm/cpu/armv7/u8500/timer.c b/arch/arm/cpu/armv7/u8500/timer.c
index bb9165b..a20897b 100644
--- a/arch/arm/cpu/armv7/u8500/timer.c
+++ b/arch/arm/cpu/armv7/u8500/timer.c
@@ -100,12 +100,14 @@ ulong get_timer_masked(void)
 	/* current tick value */
 	ulong now = TICKS_TO_HZ(READ_TIMER());
 
-	if (now >= gd->lastinc)	/* normal (non rollover) */
-		gd->tbl += (now - gd->lastinc);
-	else			/* rollover */
-		gd->tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc) + now;
+	if (now >= gd->lastinc) {	/* normal (non rollover) */
+		gd->arch.tbl += (now - gd->lastinc);
+	} else {			/* rollover */
+		gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc)
+				+ now;
+	}
 	gd->lastinc = now;
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 /* Delay x useconds */
diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c
index 323e7b5..e126ebb 100644
--- a/arch/arm/cpu/armv7/zynq/timer.c
+++ b/arch/arm/cpu/armv7/zynq/timer.c
@@ -85,7 +85,7 @@ int timer_init(void)
 	/* Reset time */
 	gd->lastinc = readl(&timer_base->counter) /
 					(TIMER_TICK_HZ / CONFIG_SYS_HZ);
-	gd->tbl = 0;
+	gd->arch.tbl = 0;
 
 	return 0;
 }
@@ -102,14 +102,14 @@ ulong get_timer_masked(void)
 
 	if (gd->lastinc >= now) {
 		/* Normal mode */
-		gd->tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->lastinc - now;
 	} else {
 		/* We have an overflow ... */
-		gd->tbl += gd->lastinc + TIMER_LOAD_VAL - now;
+		gd->arch.tbl += gd->lastinc + TIMER_LOAD_VAL - now;
 	}
 	gd->lastinc = now;
 
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 void __udelay(unsigned long usec)
diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c
index a8f7462..7799c14 100644
--- a/arch/arm/cpu/pxa/timer.c
+++ b/arch/arm/cpu/pxa/timer.c
@@ -31,7 +31,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define	TIMER_LOAD_VAL	0xffffffff
 
-#define	timestamp	(gd->tbl)
+#define	timestamp	(gd->arch.tbl)
 #define	lastinc		(gd->lastinc)
 
 #if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
diff --git a/arch/arm/cpu/tegra-common/timer.c b/arch/arm/cpu/tegra-common/timer.c
index 034ea5a..dc9cc6c 100644
--- a/arch/arm/cpu/tegra-common/timer.c
+++ b/arch/arm/cpu/tegra-common/timer.c
@@ -77,12 +77,12 @@ ulong get_timer_masked(void)
 
 	if (now >= gd->lastinc)	/* normal mode (non roll) */
 		/* move stamp forward with absolute diff ticks */
-		gd->tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->lastinc);
 	else	/* we have rollover of incrementer */
-		gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLK / CONFIG_SYS_HZ))
+		gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLK / CONFIG_SYS_HZ))
 				- gd->lastinc) + now;
 	gd->lastinc = now;
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 /*
diff --git a/arch/arm/imx-common/timer.c b/arch/arm/imx-common/timer.c
index b021903..de21e44 100644
--- a/arch/arm/imx-common/timer.c
+++ b/arch/arm/imx-common/timer.c
@@ -48,7 +48,7 @@ static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define timestamp (gd->tbl)
+#define timestamp (gd->arch.tbl)
 #define lastinc (gd->lastinc)
 
 static inline unsigned long long tick_to_time(unsigned long long tick)
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 5d37061..41bef04 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -38,6 +38,7 @@ struct arch_global_data {
 	/* "static data" needed by most of timer.c on ARM platforms */
 	unsigned long timer_rate_hz;
 	unsigned long tbu;
+	unsigned long tbl;
 };
 
 /*
@@ -64,7 +65,6 @@ typedef	struct	global_data {
 #endif
 #ifdef CONFIG_ARM
 	/* "static data" needed by most of timer.c on ARM platforms */
-	unsigned long	tbl;
 	unsigned long long	timer_reset_value;
 	unsigned long	lastinc;
 #endif
diff --git a/arch/mips/cpu/xburst/timer.c b/arch/mips/cpu/xburst/timer.c
index b6b3855..8ac8bf7 100644
--- a/arch/mips/cpu/xburst/timer.c
+++ b/arch/mips/cpu/xburst/timer.c
@@ -35,7 +35,7 @@ void reset_timer_masked(void)
 {
 	/* reset time */
 	gd->lastinc = readl(&tcu->tcnt0);
-	gd->tbl = 0;
+	gd->arch.tbl = 0;
 }
 
 ulong get_timer_masked(void)
@@ -43,15 +43,15 @@ ulong get_timer_masked(void)
 	ulong now = readl(&tcu->tcnt0);
 
 	if (gd->lastinc <= now)
-		gd->tbl += now - gd->lastinc; /* normal mode */
+		gd->arch.tbl += now - gd->lastinc; /* normal mode */
 	else {
 		/* we have an overflow ... */
-		gd->tbl += TIMER_FDATA + now - gd->lastinc;
+		gd->arch.tbl += TIMER_FDATA + now - gd->lastinc;
 	}
 
 	gd->lastinc = now;
 
-	return gd->tbl;
+	return gd->arch.tbl;
 }
 
 void udelay_masked(unsigned long usec)
@@ -95,7 +95,7 @@ int timer_init(void)
 	writeb(1 << TIMER_CHAN, &tcu->tesr); /* start counting up */
 
 	gd->lastinc = 0;
-	gd->tbl = 0;
+	gd->arch.tbl = 0;
 
 	return 0;
 }
@@ -112,7 +112,7 @@ ulong get_timer(ulong base)
 
 void set_timer(ulong t)
 {
-	gd->tbl = t;
+	gd->arch.tbl = t;
 }
 
 void __udelay(unsigned long usec)
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 06/57] arm: Move lastinc to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (4 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 05/57] arm: Move tbl " Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 07/57] arm: Move timer_reset_value " Simon Glass
                   ` (51 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/arm1136/mx31/timer.c        |    8 ++++----
 arch/arm/cpu/arm1136/mx35/timer.c        |    2 +-
 arch/arm/cpu/arm1136/omap24xx/timer.c    |   12 ++++++------
 arch/arm/cpu/arm920t/at91/timer.c        |   10 +++++-----
 arch/arm/cpu/arm920t/s3c24x0/timer.c     |   10 +++++-----
 arch/arm/cpu/arm926ejs/kirkwood/timer.c  |    2 +-
 arch/arm/cpu/arm926ejs/mb86r0x/timer.c   |    2 +-
 arch/arm/cpu/arm926ejs/mx25/timer.c      |    2 +-
 arch/arm/cpu/arm926ejs/mx27/timer.c      |    2 +-
 arch/arm/cpu/arm926ejs/mxs/timer.c       |    2 +-
 arch/arm/cpu/arm926ejs/omap/timer.c      |    2 +-
 arch/arm/cpu/arm926ejs/orion5x/timer.c   |    2 +-
 arch/arm/cpu/arm926ejs/spear/timer.c     |    2 +-
 arch/arm/cpu/arm926ejs/versatile/timer.c |    2 +-
 arch/arm/cpu/armv7/omap-common/timer.c   |   11 ++++++-----
 arch/arm/cpu/armv7/s5p-common/timer.c    |   10 +++++-----
 arch/arm/cpu/armv7/socfpga/timer.c       |   11 ++++++-----
 arch/arm/cpu/armv7/u8500/timer.c         |   10 +++++-----
 arch/arm/cpu/armv7/zynq/timer.c          |   10 +++++-----
 arch/arm/cpu/ixp/timer.c                 |    8 ++++----
 arch/arm/cpu/pxa/timer.c                 |    2 +-
 arch/arm/cpu/tegra-common/timer.c        |    8 ++++----
 arch/arm/imx-common/timer.c              |    2 +-
 arch/arm/include/asm/global_data.h       |    2 +-
 arch/mips/cpu/xburst/timer.c             |   12 ++++++------
 25 files changed, 74 insertions(+), 72 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/timer.c b/arch/arm/cpu/arm1136/mx31/timer.c
index 7a377cc..1a7f71e 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -115,12 +115,12 @@ unsigned long long get_ticks(void)
 {
 	ulong now = GPTCNT; /* current tick value */
 
-	if (now >= gd->lastinc)	/* normal mode (non roll) */
+	if (now >= gd->arch.lastinc)	/* normal mode (non roll) */
 		/* move stamp forward with absolut diff ticks */
-		gd->arch.tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	else			/* we have rollover of incrementer */
-		gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now;
-	gd->lastinc = now;
+		gd->arch.tbl += (0xFFFFFFFF - gd->arch.lastinc) + now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
diff --git a/arch/arm/cpu/arm1136/mx35/timer.c b/arch/arm/cpu/arm1136/mx35/timer.c
index c21ca3f..584ad15 100644
--- a/arch/arm/cpu/arm1136/mx35/timer.c
+++ b/arch/arm/cpu/arm1136/mx35/timer.c
@@ -33,7 +33,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp	(gd->arch.tbl)
-#define lastinc		(gd->lastinc)
+#define lastinc		(gd->arch.lastinc)
 
 /* General purpose timers bitfields */
 #define GPTCR_SWR       (1<<15)	/* Software reset */
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c b/arch/arm/cpu/arm1136/omap24xx/timer.c
index e179bb5..53015cb 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -51,7 +51,7 @@ int timer_init (void)
 	*((int32_t *) (CONFIG_SYS_TIMERBASE + TCLR)) = val;	/* start timer */
 
 	/* reset time */
-	gd->lastinc = READ_TIMER;	/* capture current incrementer value */
+	gd->arch.lastinc = READ_TIMER;	/* capture current incrementer value */
 	gd->arch.tbl = 0;		/* start "advancing" time stamp */
 
 	return(0);
@@ -81,7 +81,7 @@ void __udelay (unsigned long usec)
 	tmp = get_timer (0);		/* get current timestamp */
 	if ((tmo + tmp + 1) < tmp) {	/* if setting this forward will roll */
 					/* time stamp, then reset time */
-		gd->lastinc = READ_TIMER;	/* capture incrementer value */
+		gd->arch.lastinc = READ_TIMER;	/* capture incrementer value */
 		gd->arch.tbl = 0;			/* start time stamp */
 	} else {
 		tmo	+= tmp;		/* else, set advancing stamp wake up time */
@@ -94,14 +94,14 @@ ulong get_timer_masked (void)
 {
 	ulong now = READ_TIMER;		/* current tick value */
 
-	if (now >= gd->lastinc) {		/* normal mode (non roll) */
+	if (now >= gd->arch.lastinc) {		/* normal mode (non roll) */
 		/* move stamp fordward with absoulte diff ticks */
-		gd->arch.tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	} else {
 		/* we have rollover of incrementer */
-		gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now;
+		gd->arch.tbl += (0xFFFFFFFF - gd->arch.lastinc) + now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
diff --git a/arch/arm/cpu/arm920t/at91/timer.c b/arch/arm/cpu/arm920t/at91/timer.c
index 439ceab..8ce7584 100644
--- a/arch/arm/cpu/arm920t/at91/timer.c
+++ b/arch/arm/cpu/arm920t/at91/timer.c
@@ -63,7 +63,7 @@ int timer_init(void)
 	writel(TIMER_LOAD_VAL, &tc->tc[0].rc);
 
 	writel(AT91_TC_CCR_SWTRG | AT91_TC_CCR_CLKEN, &tc->tc[0].ccr);
-	gd->lastinc = 0;
+	gd->arch.lastinc = 0;
 	gd->arch.tbl = 0;
 
 	return 0;
@@ -89,14 +89,14 @@ ulong get_timer_raw(void)
 
 	now = readl(&tc->tc[0].cv) & 0x0000ffff;
 
-	if (now >= gd->lastinc) {
+	if (now >= gd->arch.lastinc) {
 		/* normal mode */
-		gd->arch.tbl += now - gd->lastinc;
+		gd->arch.tbl += now - gd->arch.lastinc;
 	} else {
 		/* we have an overflow ... */
-		gd->arch.tbl += now + TIMER_LOAD_VAL - gd->lastinc;
+		gd->arch.tbl += now + TIMER_LOAD_VAL - gd->arch.lastinc;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
diff --git a/arch/arm/cpu/arm920t/s3c24x0/timer.c b/arch/arm/cpu/arm920t/s3c24x0/timer.c
index eb2b8d0..d76bf18 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/timer.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/timer.c
@@ -62,7 +62,7 @@ int timer_init(void)
 	/* auto load, start timer 4 */
 	tmr = (tmr & ~0x0700000) | 0x0500000;
 	writel(tmr, &timers->tcon);
-	gd->lastinc = 0;
+	gd->arch.lastinc = 0;
 	gd->arch.tbl = 0;
 
 	return 0;
@@ -128,14 +128,14 @@ unsigned long long get_ticks(void)
 	struct s3c24x0_timers *timers = s3c24x0_get_base_timers();
 	ulong now = readl(&timers->tcnto4) & 0xffff;
 
-	if (gd->lastinc >= now) {
+	if (gd->arch.lastinc >= now) {
 		/* normal mode */
-		gd->arch.tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->arch.lastinc - now;
 	} else {
 		/* we have an overflow ... */
-		gd->arch.tbl += gd->lastinc + gd->arch.tbu - now;
+		gd->arch.tbl += gd->arch.lastinc + gd->arch.tbu - now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/timer.c b/arch/arm/cpu/arm926ejs/kirkwood/timer.c
index 41dc074..85e81e3 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/timer.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/timer.c
@@ -87,7 +87,7 @@ struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers *)KW_TIMER_BASE;
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 ulong get_timer_masked(void)
 {
diff --git a/arch/arm/cpu/arm926ejs/mb86r0x/timer.c b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
index 1f1900e..c6486c1 100644
--- a/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
+++ b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
@@ -36,7 +36,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 static inline unsigned long long tick_to_time(unsigned long long tick)
 {
diff --git a/arch/arm/cpu/arm926ejs/mx25/timer.c b/arch/arm/cpu/arm926ejs/mx25/timer.c
index 8b5217f..f8bebcc 100644
--- a/arch/arm/cpu/arm926ejs/mx25/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx25/timer.c
@@ -45,7 +45,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp	(gd->arch.tbl)
-#define lastinc		(gd->lastinc)
+#define lastinc		(gd->arch.lastinc)
 
 /*
  * "time" is measured in 1 / CONFIG_SYS_HZ seconds,
diff --git a/arch/arm/cpu/arm926ejs/mx27/timer.c b/arch/arm/cpu/arm926ejs/mx27/timer.c
index 06e3086..07e132a 100644
--- a/arch/arm/cpu/arm926ejs/mx27/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx27/timer.c
@@ -46,7 +46,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp	(gd->arch.tbl)
-#define lastinc		(gd->lastinc)
+#define lastinc		(gd->arch.lastinc)
 
 /*
  * "time" is measured in 1 / CONFIG_SYS_HZ seconds,
diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c b/arch/arm/cpu/arm926ejs/mxs/timer.c
index a12a7e3..3738411 100644
--- a/arch/arm/cpu/arm926ejs/mxs/timer.c
+++ b/arch/arm/cpu/arm926ejs/mxs/timer.c
@@ -37,7 +37,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp (gd->arch.tbl)
-#define lastdec (gd->lastinc)
+#define lastdec (gd->arch.lastinc)
 
 /*
  * This driver uses 1kHz clock source.
diff --git a/arch/arm/cpu/arm926ejs/omap/timer.c b/arch/arm/cpu/arm926ejs/omap/timer.c
index 71b8700..34ec7b2 100644
--- a/arch/arm/cpu/arm926ejs/omap/timer.c
+++ b/arch/arm/cpu/arm926ejs/omap/timer.c
@@ -45,7 +45,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 int timer_init (void)
 {
diff --git a/arch/arm/cpu/arm926ejs/orion5x/timer.c b/arch/arm/cpu/arm926ejs/orion5x/timer.c
index f69af71..f723351 100644
--- a/arch/arm/cpu/arm926ejs/orion5x/timer.c
+++ b/arch/arm/cpu/arm926ejs/orion5x/timer.c
@@ -93,7 +93,7 @@ static inline ulong read_timer(void)
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 ulong get_timer_masked(void)
 {
diff --git a/arch/arm/cpu/arm926ejs/spear/timer.c b/arch/arm/cpu/arm926ejs/spear/timer.c
index 06ea65b..de4ba7b 100644
--- a/arch/arm/cpu/arm926ejs/spear/timer.c
+++ b/arch/arm/cpu/arm926ejs/spear/timer.c
@@ -39,7 +39,7 @@ static struct misc_regs *const misc_regs_p =
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 int timer_init(void)
 {
diff --git a/arch/arm/cpu/arm926ejs/versatile/timer.c b/arch/arm/cpu/arm926ejs/versatile/timer.c
index be73b93..b36d6d9 100644
--- a/arch/arm/cpu/arm926ejs/versatile/timer.c
+++ b/arch/arm/cpu/arm926ejs/versatile/timer.c
@@ -45,7 +45,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 #define TIMER_ENABLE	(1 << 7)
 #define TIMER_MODE_MSK	(1 << 6)
diff --git a/arch/arm/cpu/armv7/omap-common/timer.c b/arch/arm/cpu/armv7/omap-common/timer.c
index e321d53..36bea5f 100644
--- a/arch/arm/cpu/armv7/omap-common/timer.c
+++ b/arch/arm/cpu/armv7/omap-common/timer.c
@@ -56,7 +56,8 @@ int timer_init(void)
 		&timer_base->tclr);
 
 	/* reset time, capture current incrementer value time */
-	gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
+	gd->arch.lastinc = readl(&timer_base->tcrr) /
+					(TIMER_CLOCK / CONFIG_SYS_HZ);
 	gd->arch.tbl = 0;	/* start "advancing" time stamp from 0 */
 
 	return 0;
@@ -91,14 +92,14 @@ ulong get_timer_masked(void)
 	/* current tick value */
 	ulong now = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
 
-	if (now >= gd->lastinc) {	/* normal mode (non roll) */
+	if (now >= gd->arch.lastinc) {	/* normal mode (non roll) */
 		/* move stamp fordward with absoulte diff ticks */
-		gd->arch.tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	} else {	/* we have rollover of incrementer */
 		gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK /
-				CONFIG_SYS_HZ)) - gd->lastinc) + now;
+				CONFIG_SYS_HZ)) - gd->arch.lastinc) + now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c
index 1566226..e78c716 100644
--- a/arch/arm/cpu/armv7/s5p-common/timer.c
+++ b/arch/arm/cpu/armv7/s5p-common/timer.c
@@ -105,7 +105,7 @@ void reset_timer_masked(void)
 	struct s5p_timer *const timer = s5p_get_base_timer();
 
 	/* reset time */
-	gd->lastinc = readl(&timer->tcnto4);
+	gd->arch.lastinc = readl(&timer->tcnto4);
 	gd->arch.tbl = 0;
 }
 
@@ -123,12 +123,12 @@ unsigned long get_current_tick(void)
 	unsigned long now = readl(&timer->tcnto4);
 	unsigned long count_value = readl(&timer->tcntb4);
 
-	if (gd->lastinc >= now)
-		gd->arch.tbl += gd->lastinc - now;
+	if (gd->arch.lastinc >= now)
+		gd->arch.tbl += gd->arch.lastinc - now;
 	else
-		gd->arch.tbl += gd->lastinc + count_value - now;
+		gd->arch.tbl += gd->arch.lastinc + count_value - now;
 
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
diff --git a/arch/arm/cpu/armv7/socfpga/timer.c b/arch/arm/cpu/armv7/socfpga/timer.c
index a742121..efa28c2 100644
--- a/arch/arm/cpu/armv7/socfpga/timer.c
+++ b/arch/arm/cpu/armv7/socfpga/timer.c
@@ -80,15 +80,15 @@ ulong get_timer_masked(void)
 {
 	/* current tick value */
 	ulong now = read_timer() / (CONFIG_TIMER_CLOCK_KHZ/CONFIG_SYS_HZ);
-	if (gd->lastinc >= now) {
+	if (gd->arch.lastinc >= now) {
 		/* normal mode (non roll) */
 		/* move stamp forward with absolute diff ticks */
-		gd->arch.tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->arch.lastinc - now;
 	} else {
 		/* we have overflow of the count down timer */
-		gd->arch.tbl += TIMER_LOAD_VAL - gd->lastinc + now;
+		gd->arch.tbl += TIMER_LOAD_VAL - gd->arch.lastinc + now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
@@ -98,7 +98,8 @@ ulong get_timer_masked(void)
 void reset_timer(void)
 {
 	/* capture current decrementer value time */
-	gd->lastinc = read_timer() / (CONFIG_TIMER_CLOCK_KHZ/CONFIG_SYS_HZ);
+	gd->arch.lastinc = read_timer() /
+				(CONFIG_TIMER_CLOCK_KHZ / CONFIG_SYS_HZ);
 	/* start "advancing" time stamp from 0 */
 	gd->arch.tbl = 0;
 }
diff --git a/arch/arm/cpu/armv7/u8500/timer.c b/arch/arm/cpu/armv7/u8500/timer.c
index a20897b..a4b88f3 100644
--- a/arch/arm/cpu/armv7/u8500/timer.c
+++ b/arch/arm/cpu/armv7/u8500/timer.c
@@ -100,13 +100,13 @@ ulong get_timer_masked(void)
 	/* current tick value */
 	ulong now = TICKS_TO_HZ(READ_TIMER());
 
-	if (now >= gd->lastinc) {	/* normal (non rollover) */
-		gd->arch.tbl += (now - gd->lastinc);
+	if (now >= gd->arch.lastinc) {	/* normal (non rollover) */
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	} else {			/* rollover */
-		gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc)
-				+ now;
+		gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) -
+					gd->arch.lastinc) + now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c
index e126ebb..45b405a 100644
--- a/arch/arm/cpu/armv7/zynq/timer.c
+++ b/arch/arm/cpu/armv7/zynq/timer.c
@@ -83,7 +83,7 @@ int timer_init(void)
 								emask);
 
 	/* Reset time */
-	gd->lastinc = readl(&timer_base->counter) /
+	gd->arch.lastinc = readl(&timer_base->counter) /
 					(TIMER_TICK_HZ / CONFIG_SYS_HZ);
 	gd->arch.tbl = 0;
 
@@ -100,14 +100,14 @@ ulong get_timer_masked(void)
 
 	now = readl(&timer_base->counter) / (TIMER_TICK_HZ / CONFIG_SYS_HZ);
 
-	if (gd->lastinc >= now) {
+	if (gd->arch.lastinc >= now) {
 		/* Normal mode */
-		gd->arch.tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->arch.lastinc - now;
 	} else {
 		/* We have an overflow ... */
-		gd->arch.tbl += gd->lastinc + TIMER_LOAD_VAL - now;
+		gd->arch.tbl += gd->arch.lastinc + TIMER_LOAD_VAL - now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
diff --git a/arch/arm/cpu/ixp/timer.c b/arch/arm/cpu/ixp/timer.c
index 087ddf8..0450b51 100644
--- a/arch/arm/cpu/ixp/timer.c
+++ b/arch/arm/cpu/ixp/timer.c
@@ -70,13 +70,13 @@ unsigned long long get_ticks(void)
 
 	if (readl(IXP425_OSST) & IXP425_OSST_TIMER_TS_PEND) {
 		/* rollover of timestamp timer register */
-		gd->timestamp += (0xFFFFFFFF - gd->lastinc) + now + 1;
+		gd->timestamp += (0xFFFFFFFF - gd->arch.lastinc) + now + 1;
 		writel(IXP425_OSST_TIMER_TS_PEND, IXP425_OSST);
 	} else {
 		/* move stamp forward with absolut diff ticks */
-		gd->timestamp += (now - gd->lastinc);
+		gd->timestamp += (now - gd->arch.lastinc);
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	return gd->timestamp;
 }
 
@@ -84,7 +84,7 @@ unsigned long long get_ticks(void)
 void reset_timer_masked(void)
 {
 	/* capture current timestamp counter */
-	gd->lastinc = readl(IXP425_OSTS_B);
+	gd->arch.lastinc = readl(IXP425_OSTS_B);
 	/* start "advancing" time stamp from 0 */
 	gd->timestamp = 0;
 }
diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c
index 7799c14..212b31e 100644
--- a/arch/arm/cpu/pxa/timer.c
+++ b/arch/arm/cpu/pxa/timer.c
@@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define	TIMER_LOAD_VAL	0xffffffff
 
 #define	timestamp	(gd->arch.tbl)
-#define	lastinc		(gd->lastinc)
+#define	lastinc		(gd->arch.lastinc)
 
 #if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
 #define	TIMER_FREQ_HZ	3250000
diff --git a/arch/arm/cpu/tegra-common/timer.c b/arch/arm/cpu/tegra-common/timer.c
index dc9cc6c..51902e9 100644
--- a/arch/arm/cpu/tegra-common/timer.c
+++ b/arch/arm/cpu/tegra-common/timer.c
@@ -75,13 +75,13 @@ ulong get_timer_masked(void)
 	/* current tick value */
 	now = timer_get_us() / (TIMER_CLK / CONFIG_SYS_HZ);
 
-	if (now >= gd->lastinc)	/* normal mode (non roll) */
+	if (now >= gd->arch.lastinc)	/* normal mode (non roll) */
 		/* move stamp forward with absolute diff ticks */
-		gd->arch.tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	else	/* we have rollover of incrementer */
 		gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLK / CONFIG_SYS_HZ))
-				- gd->lastinc) + now;
-	gd->lastinc = now;
+				- gd->arch.lastinc) + now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
diff --git a/arch/arm/imx-common/timer.c b/arch/arm/imx-common/timer.c
index de21e44..ab37d64 100644
--- a/arch/arm/imx-common/timer.c
+++ b/arch/arm/imx-common/timer.c
@@ -49,7 +49,7 @@ static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR;
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp (gd->arch.tbl)
-#define lastinc (gd->lastinc)
+#define lastinc (gd->arch.lastinc)
 
 static inline unsigned long long tick_to_time(unsigned long long tick)
 {
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 41bef04..7d7f3cf 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -39,6 +39,7 @@ struct arch_global_data {
 	unsigned long timer_rate_hz;
 	unsigned long tbu;
 	unsigned long tbl;
+	unsigned long lastinc;
 };
 
 /*
@@ -66,7 +67,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_ARM
 	/* "static data" needed by most of timer.c on ARM platforms */
 	unsigned long long	timer_reset_value;
-	unsigned long	lastinc;
 #endif
 #ifdef CONFIG_IXP425
 	unsigned long	timestamp;
diff --git a/arch/mips/cpu/xburst/timer.c b/arch/mips/cpu/xburst/timer.c
index 8ac8bf7..8c33d3c 100644
--- a/arch/mips/cpu/xburst/timer.c
+++ b/arch/mips/cpu/xburst/timer.c
@@ -34,7 +34,7 @@ static struct jz4740_tcu *tcu = (struct jz4740_tcu *)JZ4740_TCU_BASE;
 void reset_timer_masked(void)
 {
 	/* reset time */
-	gd->lastinc = readl(&tcu->tcnt0);
+	gd->arch.lastinc = readl(&tcu->tcnt0);
 	gd->arch.tbl = 0;
 }
 
@@ -42,14 +42,14 @@ ulong get_timer_masked(void)
 {
 	ulong now = readl(&tcu->tcnt0);
 
-	if (gd->lastinc <= now)
-		gd->arch.tbl += now - gd->lastinc; /* normal mode */
+	if (gd->arch.lastinc <= now)
+		gd->arch.tbl += now - gd->arch.lastinc; /* normal mode */
 	else {
 		/* we have an overflow ... */
-		gd->arch.tbl += TIMER_FDATA + now - gd->lastinc;
+		gd->arch.tbl += TIMER_FDATA + now - gd->arch.lastinc;
 	}
 
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
@@ -94,7 +94,7 @@ int timer_init(void)
 	writel(1 << TIMER_CHAN, &tcu->tscr); /* enable timer clock */
 	writeb(1 << TIMER_CHAN, &tcu->tesr); /* start counting up */
 
-	gd->lastinc = 0;
+	gd->arch.lastinc = 0;
 	gd->arch.tbl = 0;
 
 	return 0;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 07/57] arm: Move timer_reset_value to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (5 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 06/57] arm: Move lastinc " Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 08/57] ixp: Move timestamp " Simon Glass
                   ` (50 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/arm926ejs/davinci/timer.c |    4 ++--
 arch/arm/include/asm/global_data.h     |    5 +----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c
index b620bf7..4142932 100644
--- a/arch/arm/cpu/arm926ejs/davinci/timer.c
+++ b/arch/arm/cpu/arm926ejs/davinci/timer.c
@@ -61,7 +61,7 @@ int timer_init(void)
 	writel(TIMER_LOAD_VAL, &timer->prd34);
 	writel(2 << 22, &timer->tcr);
 	gd->arch.timer_rate_hz = CONFIG_SYS_HZ_CLOCK / TIM_CLK_DIV;
-	gd->timer_reset_value = 0;
+	gd->arch.timer_reset_value = 0;
 
 	return(0);
 }
@@ -85,7 +85,7 @@ ulong get_timer(ulong base)
 {
 	unsigned long long timer_diff;
 
-	timer_diff = get_ticks() - gd->timer_reset_value;
+	timer_diff = get_ticks() - gd->arch.timer_reset_value;
 
 	return lldiv(timer_diff,
 		     (gd->arch.timer_rate_hz / CONFIG_SYS_HZ)) - base;
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 7d7f3cf..95e23e1 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -40,6 +40,7 @@ struct arch_global_data {
 	unsigned long tbu;
 	unsigned long tbl;
 	unsigned long lastinc;
+	unsigned long long timer_reset_value;
 };
 
 /*
@@ -64,10 +65,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_FSL_ESDHC
 	unsigned long	sdhc_clk;
 #endif
-#ifdef CONFIG_ARM
-	/* "static data" needed by most of timer.c on ARM platforms */
-	unsigned long long	timer_reset_value;
-#endif
 #ifdef CONFIG_IXP425
 	unsigned long	timestamp;
 #endif
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 08/57] ixp: Move timestamp to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (6 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 07/57] arm: Move timer_reset_value " Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 22:22   ` Marek Vasut
  2012-11-16 21:19 ` [U-Boot] [PATCH 09/57] nds32: Drop tlb_addr from global data Simon Glass
                   ` (49 subsequent siblings)
  57 siblings, 1 reply; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/ixp/timer.c           |    8 ++++----
 arch/arm/include/asm/global_data.h |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/ixp/timer.c b/arch/arm/cpu/ixp/timer.c
index 0450b51..663d989 100644
--- a/arch/arm/cpu/ixp/timer.c
+++ b/arch/arm/cpu/ixp/timer.c
@@ -70,14 +70,14 @@ unsigned long long get_ticks(void)
 
 	if (readl(IXP425_OSST) & IXP425_OSST_TIMER_TS_PEND) {
 		/* rollover of timestamp timer register */
-		gd->timestamp += (0xFFFFFFFF - gd->arch.lastinc) + now + 1;
+		gd->arch.timestamp += (0xFFFFFFFF - gd->arch.lastinc) + now + 1;
 		writel(IXP425_OSST_TIMER_TS_PEND, IXP425_OSST);
 	} else {
 		/* move stamp forward with absolut diff ticks */
-		gd->timestamp += (now - gd->arch.lastinc);
+		gd->arch.timestamp += (now - gd->arch.lastinc);
 	}
 	gd->arch.lastinc = now;
-	return gd->timestamp;
+	return gd->arch.timestamp;
 }
 
 
@@ -86,7 +86,7 @@ void reset_timer_masked(void)
 	/* capture current timestamp counter */
 	gd->arch.lastinc = readl(IXP425_OSTS_B);
 	/* start "advancing" time stamp from 0 */
-	gd->timestamp = 0;
+	gd->arch.timestamp = 0;
 }
 
 ulong get_timer_masked(void)
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 95e23e1..35d07d0 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -41,6 +41,9 @@ struct arch_global_data {
 	unsigned long tbl;
 	unsigned long lastinc;
 	unsigned long long timer_reset_value;
+#ifdef CONFIG_IXP425
+	unsigned long timestamp;
+#endif
 };
 
 /*
@@ -65,9 +68,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_FSL_ESDHC
 	unsigned long	sdhc_clk;
 #endif
-#ifdef CONFIG_IXP425
-	unsigned long	timestamp;
-#endif
 	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	mon_len;	/* monitor len */
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 09/57] nds32: Drop tlb_addr from global data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (7 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 08/57] ixp: Move timestamp " Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 10/57] arm: Move tlb_addr to arch_global_data Simon Glass
                   ` (48 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

This field doesn't appear to be used for anything important, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/nds32/include/asm/global_data.h |    3 ---
 arch/nds32/lib/board.c               |   11 -----------
 2 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/arch/nds32/include/asm/global_data.h b/arch/nds32/include/asm/global_data.h
index 475bb44..e693b01 100644
--- a/arch/nds32/include/asm/global_data.h
+++ b/arch/nds32/include/asm/global_data.h
@@ -62,9 +62,6 @@ typedef	struct global_data {
 	unsigned long	mon_len;	/* monitor len */
 	unsigned long	irq_sp;		/* irq stack pointer */
 	unsigned long	start_addr_sp;	/* start_addr_stackpointer */
-#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
-	unsigned long	tlb_addr;
-#endif
 
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c
index 91395ca..09feaf3 100644
--- a/arch/nds32/lib/board.c
+++ b/arch/nds32/lib/board.c
@@ -207,17 +207,6 @@ void board_init_f(ulong bootflag)
 
 	addr = CONFIG_SYS_SDRAM_BASE + gd->ram_size;
 
-#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
-	/* reserve TLB table */
-	addr -= (4096 * 4);
-
-	/* round down to next 64 kB limit */
-	addr &= ~(0x10000 - 1);
-
-	gd->tlb_addr = addr;
-	debug("TLB table at: %08lx\n", addr);
-#endif
-
 	/* round down to next 4 kB limit */
 	addr &= ~(4096 - 1);
 	debug("Top of RAM usable for U-Boot at: %08lx\n", addr);
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 10/57] arm: Move tlb_addr to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (8 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 09/57] nds32: Drop tlb_addr from global data Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 11/57] x86: Move gdt_addr, new_gd_addr " Simon Glass
                   ` (47 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/include/asm/global_data.h |    6 +++---
 arch/arm/lib/board.c               |    2 +-
 arch/arm/lib/cache-cp15.c          |    4 ++--
 common/cmd_bdinfo.c                |    2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 35d07d0..0d1ebfd 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -44,6 +44,9 @@ struct arch_global_data {
 #ifdef CONFIG_IXP425
 	unsigned long timestamp;
 #endif
+#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
+	unsigned long tlb_addr;
+#endif
 };
 
 /*
@@ -74,9 +77,6 @@ typedef	struct	global_data {
 	unsigned long	irq_sp;		/* irq stack pointer */
 	unsigned long	start_addr_sp;	/* start_addr_stackpointer */
 	unsigned long	reloc_off;
-#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
-	unsigned long	tlb_addr;
-#endif
 	const void	*fdt_blob;	/* Our device tree, NULL if none */
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 92cad9a..43cd970 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -351,7 +351,7 @@ void board_init_f(ulong bootflag)
 	/* round down to next 64 kB limit */
 	addr &= ~(0x10000 - 1);
 
-	gd->tlb_addr = addr;
+	gd->arch.tlb_addr = addr;
 	debug("TLB table at: %08lx\n", addr);
 #endif
 
diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
index 939de10..5df6735 100644
--- a/arch/arm/lib/cache-cp15.c
+++ b/arch/arm/lib/cache-cp15.c
@@ -52,7 +52,7 @@ static void cp_delay (void)
 
 static inline void dram_bank_mmu_setup(int bank)
 {
-	u32 *page_table = (u32 *)gd->tlb_addr;
+	u32 *page_table = (u32 *)gd->arch.tlb_addr;
 	bd_t *bd = gd->bd;
 	int	i;
 
@@ -67,7 +67,7 @@ static inline void dram_bank_mmu_setup(int bank)
 /* to activate the MMU we need to set up virtual memory: use 1M areas */
 static inline void mmu_setup(void)
 {
-	u32 *page_table = (u32 *)gd->tlb_addr;
+	u32 *page_table = (u32 *)gd->arch.tlb_addr;
 	int i;
 	u32 reg;
 
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 48cdd16..82a3693 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -371,7 +371,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #endif
 	printf("baudrate    = %u bps\n", bd->bi_baudrate);
 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
-	print_num("TLB addr", gd->tlb_addr);
+	print_num("TLB addr", gd->arch.tlb_addr);
 #endif
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 11/57] x86: Move gdt_addr, new_gd_addr to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (9 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 10/57] arm: Move tlb_addr to arch_global_data Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 12/57] x86: Remove reset_status, relocoff from global_data Simon Glass
                   ` (46 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move these field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/x86/include/asm/global_data.h |    4 ++--
 arch/x86/lib/init_helpers.c        |   10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index b4b749b..ce96efb 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -28,6 +28,8 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+	unsigned long gdt_addr;		/* Location of GDT */
+	unsigned long new_gd_addr;	/* New location of Global Data */
 };
 
 /*
@@ -56,8 +58,6 @@ typedef	struct global_data {
 	unsigned long	bus_clk;
 	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
 	unsigned long	start_addr_sp;	/* start_addr_stackpointer */
-	unsigned long	gdt_addr;	/* Location of GDT */
-	unsigned long	new_gd_addr;	/* New location of Global Data */
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reset_status;	/* reset status register at boot */
 	void		**jt;		/* jump table */
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 9ec34ff..05cadcd 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -87,12 +87,12 @@ int calculate_relocation_address(void)
 	dest_addr = gd->ram_size;
 	dest_addr -= GENERATED_GBL_DATA_SIZE;
 	dest_addr &= ~15;
-	gd->new_gd_addr = dest_addr;
+	gd->arch.new_gd_addr = dest_addr;
 
 	/* GDT is below Global Data */
 	dest_addr -= X86_GDT_SIZE;
 	dest_addr &= ~15;
-	gd->gdt_addr = dest_addr;
+	gd->arch.gdt_addr = dest_addr;
 
 	/* Stack is below GDT */
 	gd->start_addr_sp = dest_addr;
@@ -113,12 +113,12 @@ int copy_gd_to_ram_f_r(void)
 
 	/*
 	 * Global data is still in temporary memory (the CPU cache).
-	 * calculate_relocation_address() has set gd->new_gd_addr to
+	 * calculate_relocation_address() has set gd->arch.new_gd_addr to
 	 * where the global data lives in RAM but getting it there
 	 * safely is a bit tricky due to the 'F-Segment Hack' that
 	 * we need to use for x86
 	 */
-	ram_gd = (gd_t *)gd->new_gd_addr;
+	ram_gd = (gd_t *)gd->arch.new_gd_addr;
 	memcpy((void *)ram_gd, gd, sizeof(gd_t));
 
 	/*
@@ -127,7 +127,7 @@ int copy_gd_to_ram_f_r(void)
 	 * has already calculated the in-RAM location of the GDT)
 	 */
 	ram_gd->gd_addr = (ulong)ram_gd;
-	init_gd(ram_gd, (u64 *)gd->gdt_addr);
+	init_gd(ram_gd, (u64 *)gd->arch.gdt_addr);
 
 	return 0;
 }
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 12/57] x86: Remove reset_status, relocoff from global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (10 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 11/57] x86: Move gdt_addr, new_gd_addr " Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:19 ` [U-Boot] [PATCH 13/57] x86: Move new_gd_addr to arch_global_data Simon Glass
                   ` (45 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

These fields are not used on x86, so punt them.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/x86/include/asm/global_data.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index ce96efb..3df83bb 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -51,7 +51,6 @@ typedef	struct global_data {
 	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
 #endif
 	unsigned long	reloc_off;	/* Relocation Offset */
-	unsigned long	load_off;	/* Load Offset */
 	unsigned long	env_addr;	/* Address  of Environment struct */
 	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
@@ -59,7 +58,6 @@ typedef	struct global_data {
 	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
 	unsigned long	start_addr_sp;	/* start_addr_stackpointer */
 	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	reset_status;	/* reset status register at boot */
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
 	struct arch_global_data arch;	/* architecture-specific data */
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 13/57] x86: Move new_gd_addr to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (11 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 12/57] x86: Remove reset_status, relocoff from global_data Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-18  1:07   ` Graeme Russ
  2012-11-16 21:19 ` [U-Boot] [PATCH 14/57] ppc: Move brg_clk " Simon Glass
                   ` (44 subsequent siblings)
  57 siblings, 1 reply; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

This will certainly break x86, so will need Graeme's help to sort out
the problem. I would prefer not to put the architecture-specific stuff
at the top of global_data since we relying on that seems even more ugly.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/x86/cpu/cpu.c                 |    2 +-
 arch/x86/include/asm/global_data.h |   12 +++++++++---
 arch/x86/lib/init_helpers.c        |    2 +-
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index e9bb0d7..c276aa6 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -92,7 +92,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
 
 void init_gd(gd_t *id, u64 *gdt_addr)
 {
-	id->gd_addr = (ulong)id;
+	id->arch.gd_addr = (ulong)id;
 	setup_gdt(id, gdt_addr);
 }
 
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 3df83bb..d2eb00a 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -28,8 +28,16 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
-	unsigned long gdt_addr;		/* Location of GDT */
+	/*
+	 * NOTE: gd_addr MUST be first member of struct global_data!
+	 *
+	 * But it now isn't, so this is sure to break x86. Can we change
+	 * x86 to not require this? I don't think we should put the
+	 * arch data first in global_data...
+	 */
 	unsigned long new_gd_addr;	/* New location of Global Data */
+	unsigned long gd_addr;		/* Location of Global Data */
+	unsigned long gdt_addr;		/* Location of GDT */
 };
 
 /*
@@ -41,8 +49,6 @@ struct arch_global_data {
  */
 
 typedef	struct global_data {
-	/* NOTE: gd_addr MUST be first member of struct global_data! */
-	unsigned long	gd_addr;	/* Location of Global Data */
 	bd_t		*bd;
 	unsigned long	flags;
 	unsigned int	baudrate;
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 05cadcd..ac789c2 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -126,7 +126,7 @@ int copy_gd_to_ram_f_r(void)
 	 * in-RAM copy of Global Data (calculate_relocation_address()
 	 * has already calculated the in-RAM location of the GDT)
 	 */
-	ram_gd->gd_addr = (ulong)ram_gd;
+	ram_gd->arch.gd_addr = (ulong)ram_gd;
 	init_gd(ram_gd, (u64 *)gd->arch.gdt_addr);
 
 	return 0;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 14/57] ppc: Move brg_clk to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (12 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 13/57] x86: Move new_gd_addr to arch_global_data Simon Glass
@ 2012-11-16 21:19 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 15/57] ppc: Remove extra pci_clk fields from global_data Simon Glass
                   ` (43 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:19 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc8260/commproc.c    |    2 +-
 arch/powerpc/cpu/mpc8260/i2c.c         |    2 +-
 arch/powerpc/cpu/mpc8260/speed.c       |    4 ++--
 arch/powerpc/cpu/mpc83xx/speed.c       |    5 +++--
 arch/powerpc/cpu/mpc85xx/commproc.c    |    2 +-
 arch/powerpc/cpu/mpc85xx/speed.c       |    4 ++--
 arch/powerpc/cpu/mpc8xx/fdt.c          |    2 +-
 arch/powerpc/cpu/mpc8xx/speed.c        |    2 +-
 arch/powerpc/include/asm/global_data.h |   14 +++++++++-----
 arch/powerpc/lib/board.c               |    2 +-
 common/cmd_immap.c                     |    2 +-
 drivers/qe/fdt.c                       |    4 ++--
 drivers/qe/qe.c                        |    2 +-
 13 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8260/commproc.c b/arch/powerpc/cpu/mpc8260/commproc.c
index 082957e..e5bfed1 100644
--- a/arch/powerpc/cpu/mpc8260/commproc.c
+++ b/arch/powerpc/cpu/mpc8260/commproc.c
@@ -101,7 +101,7 @@ m8260_cpm_hostalloc(uint size, uint align)
  * Baud rate clocks are zero-based in the driver code (as that maps
  * to port numbers).  Documentation uses 1-based numbering.
  */
-#define BRG_INT_CLK	gd->brg_clk
+#define BRG_INT_CLK	gd->arch.brg_clk
 #define BRG_UART_CLK	(BRG_INT_CLK / 16)
 
 /* This function is used by UARTs, or anything else that uses a 16x
diff --git a/arch/powerpc/cpu/mpc8260/i2c.c b/arch/powerpc/cpu/mpc8260/i2c.c
index 7382cba..b720b1f 100644
--- a/arch/powerpc/cpu/mpc8260/i2c.c
+++ b/arch/powerpc/cpu/mpc8260/i2c.c
@@ -259,7 +259,7 @@ void i2c_init(int speed, int slaveadd)
 	 * divide BRGCLK by 1)
 	 */
 	debug("[I2C] Setting rate...\n");
-	i2c_setrate(gd->brg_clk, CONFIG_SYS_I2C_SPEED);
+	i2c_setrate(gd->arch.brg_clk, CONFIG_SYS_I2C_SPEED);
 
 	/* Set I2C controller in master mode */
 	i2c->i2c_i2com = 0x01;
diff --git a/arch/powerpc/cpu/mpc8260/speed.c b/arch/powerpc/cpu/mpc8260/speed.c
index bb50dee..4ad1ec2 100644
--- a/arch/powerpc/cpu/mpc8260/speed.c
+++ b/arch/powerpc/cpu/mpc8260/speed.c
@@ -145,7 +145,7 @@ int get_clocks (void)
 	gd->cpm_clk = gd->vco_out / 2;
 	gd->bus_clk = clkin;
 	gd->scc_clk = gd->vco_out / 4;
-	gd->brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
+	gd->arch.brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
 
 	if (cp->b2c_mult > 0) {
 		gd->cpu_clk = (clkin * cp->b2c_mult) / 2;
@@ -231,7 +231,7 @@ int prt_8260_clks (void)
 			plldf, pllmf, pcidf);
 
 	printf (" - vco_out %10ld, scc_clk %10ld, brg_clk %10ld\n",
-			gd->vco_out, gd->scc_clk, gd->brg_clk);
+			gd->vco_out, gd->scc_clk, gd->arch.brg_clk);
 
 	printf (" - cpu_clk %10ld, cpm_clk %10ld, bus_clk %10ld\n",
 			gd->cpu_clk, gd->cpm_clk, gd->bus_clk);
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index b8c05d1..21e8b0a 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -496,7 +496,7 @@ int get_clocks(void)
 #endif
 #if defined(CONFIG_QE)
 	gd->qe_clk = qe_clk;
-	gd->brg_clk = brg_clk;
+	gd->arch.brg_clk = brg_clk;
 #endif
 #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
 	defined(CONFIG_MPC837x)
@@ -540,7 +540,8 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	printf("  Coherent System Bus: %-4s MHz\n", strmhz(buf, gd->csb_clk));
 #if defined(CONFIG_QE)
 	printf("  QE:                  %-4s MHz\n", strmhz(buf, gd->qe_clk));
-	printf("  BRG:                 %-4s MHz\n", strmhz(buf, gd->brg_clk));
+	printf("  BRG:                 %-4s MHz\n",
+	       strmhz(buf, gd->arch.brg_clk));
 #endif
 	printf("  Local Bus Controller:%-4s MHz\n", strmhz(buf, gd->lbiu_clk));
 	printf("  Local Bus:           %-4s MHz\n", strmhz(buf, gd->lclk_clk));
diff --git a/arch/powerpc/cpu/mpc85xx/commproc.c b/arch/powerpc/cpu/mpc85xx/commproc.c
index 292b723..7f10476 100644
--- a/arch/powerpc/cpu/mpc85xx/commproc.c
+++ b/arch/powerpc/cpu/mpc85xx/commproc.c
@@ -110,7 +110,7 @@ m8560_cpm_hostalloc(uint size, uint align)
  * Baud rate clocks are zero-based in the driver code (as that maps
  * to port numbers).  Documentation uses 1-based numbering.
  */
-#define BRG_INT_CLK	gd->brg_clk
+#define BRG_INT_CLK	gd->arch.brg_clk
 #define BRG_UART_CLK	((BRG_INT_CLK + 15) / 16)
 
 /* This function is used by UARTS, or anything else that uses a 16x
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index 801ee07..8a581ef 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -395,7 +395,7 @@ int get_clocks (void)
 
 #ifdef CONFIG_QE
 	gd->qe_clk = sys_info.freqQE;
-	gd->brg_clk = gd->qe_clk / 2;
+	gd->arch.brg_clk = gd->qe_clk / 2;
 #endif
 	/*
 	 * The base clock for I2C depends on the actual SOC.  Unfortunately,
@@ -438,7 +438,7 @@ int get_clocks (void)
 	gd->vco_out = 2*sys_info.freqSystemBus;
 	gd->cpm_clk = gd->vco_out / 2;
 	gd->scc_clk = gd->vco_out / 4;
-	gd->brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
+	gd->arch.brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
 #endif
 
 	if(gd->cpu_clk != 0) return (0);
diff --git a/arch/powerpc/cpu/mpc8xx/fdt.c b/arch/powerpc/cpu/mpc8xx/fdt.c
index 7130983..7edd7e4 100644
--- a/arch/powerpc/cpu/mpc8xx/fdt.c
+++ b/arch/powerpc/cpu/mpc8xx/fdt.c
@@ -37,7 +37,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
 		"clock-frequency", bd->bi_intfreq, 1);
 	do_fixup_by_compat_u32(blob, "fsl,cpm-brg", "clock-frequency",
-		gd->brg_clk, 1);
+		gd->arch.brg_clk, 1);
 
 	/* Fixup ethernet MAC addresses */
 	fdt_fixup_ethernet(blob);
diff --git a/arch/powerpc/cpu/mpc8xx/speed.c b/arch/powerpc/cpu/mpc8xx/speed.c
index 6e13e5d..091b49f 100644
--- a/arch/powerpc/cpu/mpc8xx/speed.c
+++ b/arch/powerpc/cpu/mpc8xx/speed.c
@@ -192,7 +192,7 @@ void get_brgclk(uint sccr)
 			divider = 64;
 			break;
 	}
-	gd->brg_clk = gd->cpu_clk/divider;
+	gd->arch.brg_clk = gd->cpu_clk/divider;
 }
 
 #if !defined(CONFIG_8xx_CPUCLK_DEFAULT)
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index df621da..ac348c6 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -29,6 +29,15 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+#if defined(CONFIG_8xx)
+	unsigned long brg_clk;
+#endif
+#if defined(CONFIG_CPM2)
+	unsigned long brg_clk;
+#endif
+#if defined(CONFIG_QE)
+	u32 brg_clk;
+#endif
 };
 
 /*
@@ -45,15 +54,11 @@ typedef	struct	global_data {
 	unsigned int	baudrate;
 	unsigned long	cpu_clk;	/* CPU clock in Hz! */
 	unsigned long	bus_clk;
-#if defined(CONFIG_8xx)
-	unsigned long	brg_clk;
-#endif
 #if defined(CONFIG_CPM2)
 	/* There are many clocks on the MPC8260 - see page 9-5 */
 	unsigned long	vco_out;
 	unsigned long	cpm_clk;
 	unsigned long	scc_clk;
-	unsigned long	brg_clk;
 #ifdef CONFIG_PCI
 	unsigned long	pci_clk;
 #endif
@@ -106,7 +111,6 @@ typedef	struct	global_data {
 #endif
 #if defined(CONFIG_QE)
 	u32 qe_clk;
-	u32 brg_clk;
 	uint mp_alloc_base;
 	uint mp_alloc_top;
 #endif /* CONFIG_QE */
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 1b051e1..4174a73 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -581,7 +581,7 @@ void board_init_f(ulong bootflag)
 	bd->bi_busfreq = gd->bus_clk;	/* Bus Freq,      in Hz */
 #if defined(CONFIG_CPM2)
 	bd->bi_cpmfreq = gd->cpm_clk;
-	bd->bi_brgfreq = gd->brg_clk;
+	bd->bi_brgfreq = gd->arch.brg_clk;
 	bd->bi_sccfreq = gd->scc_clk;
 	bd->bi_vco = gd->vco_out;
 #endif /* CONFIG_CPM2 */
diff --git a/common/cmd_immap.c b/common/cmd_immap.c
index 1f59c1e..fdf9489 100644
--- a/common/cmd_immap.c
+++ b/common/cmd_immap.c
@@ -453,7 +453,7 @@ static void prbrg (int n, uint val)
 #if defined(CONFIG_8xx)
 	ulong clock = gd->cpu_clk;
 #elif defined(CONFIG_8260)
-	ulong clock = gd->brg_clk;
+	ulong clock = gd->arch.brg_clk;
 #endif
 
 	printf ("BRG%d:", n);
diff --git a/drivers/qe/fdt.c b/drivers/qe/fdt.c
index 73e9060..1a123b8 100644
--- a/drivers/qe/fdt.c
+++ b/drivers/qe/fdt.c
@@ -77,13 +77,13 @@ void ft_qe_setup(void *blob)
 	do_fixup_by_prop_u32(blob, "device_type", "qe", 4,
 		"bus-frequency", gd->qe_clk, 1);
 	do_fixup_by_prop_u32(blob, "device_type", "qe", 4,
-		"brg-frequency", gd->brg_clk, 1);
+		"brg-frequency", gd->arch.brg_clk, 1);
 	do_fixup_by_compat_u32(blob, "fsl,qe",
 		"clock-frequency", gd->qe_clk, 1);
 	do_fixup_by_compat_u32(blob, "fsl,qe",
 		"bus-frequency", gd->qe_clk, 1);
 	do_fixup_by_compat_u32(blob, "fsl,qe",
-		"brg-frequency", gd->brg_clk, 1);
+		"brg-frequency", gd->arch.brg_clk, 1);
 	do_fixup_by_compat_u32(blob, "fsl,qe-gtm",
 		"clock-frequency", gd->qe_clk / 2, 1);
 	fdt_fixup_qe_firmware(blob);
diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
index 345587b..72c585c 100644
--- a/drivers/qe/qe.c
+++ b/drivers/qe/qe.c
@@ -220,7 +220,7 @@ void qe_assign_page(uint snum, uint para_ram_base)
    from CLKn pin, we have te change the function.
  */
 
-#define BRG_CLK		(gd->brg_clk)
+#define BRG_CLK		(gd->arch.brg_clk)
 
 int qe_set_brg(uint brg, uint rate)
 {
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 15/57] ppc: Remove extra pci_clk fields from global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (13 preceding siblings ...)
  2012-11-16 21:19 ` [U-Boot] [PATCH 14/57] ppc: Move brg_clk " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 16/57] ppc: Move clock fields to arch_global_data Simon Glass
                   ` (42 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

PPC has several of these fields, selected by chip type, although only one
is ever compiled in.

Instead, use a single field. It would be nice if this could be selected
by CONFIG_PCI, but some chips (e.g. mpc5xxx) use pci_clk even when
CONFIG_PCI is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/include/asm/global_data.h |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index ac348c6..8e3a726 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -54,14 +54,13 @@ typedef	struct	global_data {
 	unsigned int	baudrate;
 	unsigned long	cpu_clk;	/* CPU clock in Hz! */
 	unsigned long	bus_clk;
+	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
+	unsigned long	pci_clk;
 #if defined(CONFIG_CPM2)
 	/* There are many clocks on the MPC8260 - see page 9-5 */
 	unsigned long	vco_out;
 	unsigned long	cpm_clk;
 	unsigned long	scc_clk;
-#ifdef CONFIG_PCI
-	unsigned long	pci_clk;
-#endif
 #endif
 	unsigned long   mem_clk;
 #if defined(CONFIG_MPC83xx)
@@ -85,7 +84,6 @@ typedef	struct	global_data {
 	u32 enc_clk;
 	u32 lbiu_clk;
 	u32 lclk_clk;
-	u32 pci_clk;
 #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
 	defined(CONFIG_MPC837x)
 	u32 pciexp1_clk;
@@ -122,17 +120,14 @@ typedef	struct	global_data {
 #endif
 #if defined(CONFIG_MPC5xxx)
 	unsigned long	ipb_clk;
-	unsigned long	pci_clk;
 #endif
 #if defined(CONFIG_MPC512X)
 	u32 ips_clk;
 	u32 csb_clk;
-	u32 pci_clk;
 #endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC8220)
 	unsigned long   bExtUart;
 	unsigned long   inp_clk;
-	unsigned long   pci_clk;
 	unsigned long   vco_clk;
 	unsigned long   pev_clk;
 	unsigned long   flb_clk;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 16/57] ppc: Move clock fields to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (14 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 15/57] ppc: Remove extra pci_clk fields from global_data Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 17/57] ppc: Move mpc83xx " Simon Glass
                   ` (41 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move vco_out, cpm_clk, scc_clk, brg_clk into arch_global_data and tidy
up. Leave pci_clk on its own since this should really depend only on
CONFIG_PCI and not any particular chip type.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc8260/speed.c       |   16 ++++++++--------
 arch/powerpc/cpu/mpc85xx/speed.c       |    8 ++++----
 arch/powerpc/include/asm/global_data.h |    4 ++++
 arch/powerpc/lib/board.c               |    6 +++---
 4 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8260/speed.c b/arch/powerpc/cpu/mpc8260/speed.c
index 4ad1ec2..7841e8a 100644
--- a/arch/powerpc/cpu/mpc8260/speed.c
+++ b/arch/powerpc/cpu/mpc8260/speed.c
@@ -135,17 +135,17 @@ int get_clocks (void)
 	    (get_pvr () == PVR_8260_HIP7R1) ||
 	    (get_pvr () == PVR_8260_HIP7RA)) {
 		pllmf = (scmr & SCMR_PLLMF_MSKH7) >> SCMR_PLLMF_SHIFT;
-		gd->vco_out = clkin * (pllmf + 1);
+		gd->arch.vco_out = clkin * (pllmf + 1);
 	} else {                        /* HiP3, HiP4 */
 		pllmf = (scmr & SCMR_PLLMF_MSK) >> SCMR_PLLMF_SHIFT;
 		plldf = (scmr & SCMR_PLLDF) ? 1 : 0;
-		gd->vco_out = (clkin * 2 * (pllmf + 1)) / (plldf + 1);
+		gd->arch.vco_out = (clkin * 2 * (pllmf + 1)) / (plldf + 1);
 	}
 
-	gd->cpm_clk = gd->vco_out / 2;
+	gd->arch.cpm_clk = gd->arch.vco_out / 2;
 	gd->bus_clk = clkin;
-	gd->scc_clk = gd->vco_out / 4;
-	gd->arch.brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
+	gd->arch.scc_clk = gd->arch.vco_out / 4;
+	gd->arch.brg_clk = gd->arch.vco_out / (1 << (2 * (dfbrg + 1)));
 
 	if (cp->b2c_mult > 0) {
 		gd->cpu_clk = (clkin * cp->b2c_mult) / 2;
@@ -173,7 +173,7 @@ int get_clocks (void)
 			pci_div = pcidf + 1;
 		}
 
-		gd->pci_clk = (gd->cpm_clk * 2) / pci_div;
+		gd->pci_clk = (gd->arch.cpm_clk * 2) / pci_div;
 	}
 #endif
 
@@ -231,10 +231,10 @@ int prt_8260_clks (void)
 			plldf, pllmf, pcidf);
 
 	printf (" - vco_out %10ld, scc_clk %10ld, brg_clk %10ld\n",
-			gd->vco_out, gd->scc_clk, gd->arch.brg_clk);
+			gd->arch.vco_out, gd->arch.scc_clk, gd->arch.brg_clk);
 
 	printf (" - cpu_clk %10ld, cpm_clk %10ld, bus_clk %10ld\n",
-			gd->cpu_clk, gd->cpm_clk, gd->bus_clk);
+			gd->cpu_clk, gd->arch.cpm_clk, gd->bus_clk);
 #ifdef CONFIG_PCI
 	printf (" - pci_clk %10ld\n", gd->pci_clk);
 #endif
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index 8a581ef..c4ca481 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -435,10 +435,10 @@ int get_clocks (void)
 #endif /* defined(CONFIG_FSL_ESDHC) */
 
 #if defined(CONFIG_CPM2)
-	gd->vco_out = 2*sys_info.freqSystemBus;
-	gd->cpm_clk = gd->vco_out / 2;
-	gd->scc_clk = gd->vco_out / 4;
-	gd->arch.brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
+	gd->arch.vco_out = 2*sys_info.freqSystemBus;
+	gd->arch.cpm_clk = gd->arch.vco_out / 2;
+	gd->arch.scc_clk = gd->arch.vco_out / 4;
+	gd->arch.brg_clk = gd->arch.vco_out / (1 << (2 * (dfbrg + 1)));
 #endif
 
 	if(gd->cpu_clk != 0) return (0);
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 8e3a726..7d0115d 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -33,6 +33,10 @@ struct arch_global_data {
 	unsigned long brg_clk;
 #endif
 #if defined(CONFIG_CPM2)
+	/* There are many clocks on the MPC8260 - see page 9-5 */
+	unsigned long vco_out;
+	unsigned long cpm_clk;
+	unsigned long scc_clk;
 	unsigned long brg_clk;
 #endif
 #if defined(CONFIG_QE)
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 4174a73..517560a 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -580,10 +580,10 @@ void board_init_f(ulong bootflag)
 	bd->bi_intfreq = gd->cpu_clk;	/* Internal Freq, in Hz */
 	bd->bi_busfreq = gd->bus_clk;	/* Bus Freq,      in Hz */
 #if defined(CONFIG_CPM2)
-	bd->bi_cpmfreq = gd->cpm_clk;
+	bd->bi_cpmfreq = gd->arch.cpm_clk;
 	bd->bi_brgfreq = gd->arch.brg_clk;
-	bd->bi_sccfreq = gd->scc_clk;
-	bd->bi_vco = gd->vco_out;
+	bd->bi_sccfreq = gd->arch.scc_clk;
+	bd->bi_vco = gd->arch.vco_out;
 #endif /* CONFIG_CPM2 */
 #if defined(CONFIG_MPC512X)
 	bd->bi_ipsfreq = gd->ips_clk;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 17/57] ppc: Move mpc83xx clock fields to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (15 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 16/57] ppc: Move clock fields to arch_global_data Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 18/57] ppc: Move lbc_clk and cpu " Simon Glass
                   ` (40 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move al mpc83xx fields into arch_global_data and tidy up. Also indent
the nested #ifdef for clarity.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc83xx/cpu.c         |    2 +-
 arch/powerpc/cpu/mpc83xx/fdt.c         |    2 +-
 arch/powerpc/cpu/mpc83xx/pcie.c        |    4 +-
 arch/powerpc/cpu/mpc83xx/speed.c       |   81 +++++++++++++++++++-------------
 arch/powerpc/include/asm/global_data.h |   73 +++++++++++++---------------
 5 files changed, 86 insertions(+), 76 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c
index e64b0c3..cc20234 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu.c
@@ -122,7 +122,7 @@ int checkcpu(void)
 
 	printf(" at %s MHz, ", strmhz(buf, clock));
 
-	printf("CSB: %s MHz\n", strmhz(buf, gd->csb_clk));
+	printf("CSB: %s MHz\n", strmhz(buf, gd->arch.csb_clk));
 
 	return 0;
 }
diff --git a/arch/powerpc/cpu/mpc83xx/fdt.c b/arch/powerpc/cpu/mpc83xx/fdt.c
index 1f54781..fe553a7 100644
--- a/arch/powerpc/cpu/mpc83xx/fdt.c
+++ b/arch/powerpc/cpu/mpc83xx/fdt.c
@@ -118,7 +118,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
 		"bus-frequency", bd->bi_busfreq, 1);
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
-		"clock-frequency", gd->core_clk, 1);
+		"clock-frequency", gd->arch.core_clk, 1);
 	do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
 		"bus-frequency", bd->bi_busfreq, 1);
 	do_fixup_by_compat_u32(blob, "fsl,soc",
diff --git a/arch/powerpc/cpu/mpc83xx/pcie.c b/arch/powerpc/cpu/mpc83xx/pcie.c
index 52d4461..609b133 100644
--- a/arch/powerpc/cpu/mpc83xx/pcie.c
+++ b/arch/powerpc/cpu/mpc83xx/pcie.c
@@ -286,8 +286,8 @@ static void mpc83xx_pcie_init_bus(int bus, struct pci_region *reg)
 	get_clocks();
 	/* Configure the PCIE controller core clock ratio */
 	out_le32(hose_cfg_base + PEX_GCLK_RATIO,
-		(((bus ? gd->pciexp2_clk : gd->pciexp1_clk) / 1000000) * 16)
-		/ 333);
+		(((bus ? gd->arch.pciexp2_clk : gd->arch.pciexp1_clk)
+			/ 1000000) * 16) / 333);
 	udelay(1000000);
 
 	/* Do Type 1 bridge configuration */
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index 21e8b0a..7f98ee8 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -462,37 +462,37 @@ int get_clocks(void)
 	brg_clk = qe_clk / 2;
 #endif
 
-	gd->csb_clk = csb_clk;
+	gd->arch.csb_clk = csb_clk;
 #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
 	defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x)
-	gd->tsec1_clk = tsec1_clk;
-	gd->tsec2_clk = tsec2_clk;
-	gd->usbdr_clk = usbdr_clk;
+	gd->arch.tsec1_clk = tsec1_clk;
+	gd->arch.tsec2_clk = tsec2_clk;
+	gd->arch.usbdr_clk = usbdr_clk;
 #elif defined(CONFIG_MPC8309)
-	gd->usbdr_clk = usbdr_clk;
+	gd->arch.usbdr_clk = usbdr_clk;
 #endif
 #if defined(CONFIG_MPC834x)
-	gd->usbmph_clk = usbmph_clk;
+	gd->arch.usbmph_clk = usbmph_clk;
 #endif
 #if defined(CONFIG_MPC8315)
-	gd->tdm_clk = tdm_clk;
+	gd->arch.tdm_clk = tdm_clk;
 #endif
 #if defined(CONFIG_FSL_ESDHC)
 	gd->sdhc_clk = sdhc_clk;
 #endif
-	gd->core_clk = core_clk;
+	gd->arch.core_clk = core_clk;
 	gd->i2c1_clk = i2c1_clk;
 #if !defined(CONFIG_MPC832x)
 	gd->i2c2_clk = i2c2_clk;
 #endif
 #if !defined(CONFIG_MPC8309)
-	gd->enc_clk = enc_clk;
+	gd->arch.enc_clk = enc_clk;
 #endif
-	gd->lbiu_clk = lbiu_clk;
-	gd->lclk_clk = lclk_clk;
+	gd->arch.lbiu_clk = lbiu_clk;
+	gd->arch.lclk_clk = lclk_clk;
 	gd->mem_clk = mem_clk;
 #if defined(CONFIG_MPC8360)
-	gd->mem_sec_clk = mem_sec_clk;
+	gd->arch.mem_sec_clk = mem_sec_clk;
 #endif
 #if defined(CONFIG_QE)
 	gd->qe_clk = qe_clk;
@@ -500,15 +500,15 @@ int get_clocks(void)
 #endif
 #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
 	defined(CONFIG_MPC837x)
-	gd->pciexp1_clk = pciexp1_clk;
-	gd->pciexp2_clk = pciexp2_clk;
+	gd->arch.pciexp1_clk = pciexp1_clk;
+	gd->arch.pciexp2_clk = pciexp2_clk;
 #endif
 #if defined(CONFIG_MPC837x) || defined(CONFIG_MPC8315)
-	gd->sata_clk = sata_clk;
+	gd->arch.sata_clk = sata_clk;
 #endif
 	gd->pci_clk = pci_sync_in;
-	gd->cpu_clk = gd->core_clk;
-	gd->bus_clk = gd->csb_clk;
+	gd->cpu_clk = gd->arch.core_clk;
+	gd->bus_clk = gd->arch.csb_clk;
 	return 0;
 
 }
@@ -519,7 +519,7 @@ int get_clocks(void)
  *********************************************/
 ulong get_bus_freq(ulong dummy)
 {
-	return gd->csb_clk;
+	return gd->arch.csb_clk;
 }
 
 /********************************************
@@ -536,50 +536,65 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char buf[32];
 
 	printf("Clock configuration:\n");
-	printf("  Core:                %-4s MHz\n", strmhz(buf, gd->core_clk));
-	printf("  Coherent System Bus: %-4s MHz\n", strmhz(buf, gd->csb_clk));
+	printf("  Core:                %-4s MHz\n",
+	       strmhz(buf, gd->arch.core_clk));
+	printf("  Coherent System Bus: %-4s MHz\n",
+	       strmhz(buf, gd->arch.csb_clk));
 #if defined(CONFIG_QE)
 	printf("  QE:                  %-4s MHz\n", strmhz(buf, gd->qe_clk));
 	printf("  BRG:                 %-4s MHz\n",
 	       strmhz(buf, gd->arch.brg_clk));
 #endif
-	printf("  Local Bus Controller:%-4s MHz\n", strmhz(buf, gd->lbiu_clk));
-	printf("  Local Bus:           %-4s MHz\n", strmhz(buf, gd->lclk_clk));
+	printf("  Local Bus Controller:%-4s MHz\n",
+	       strmhz(buf, gd->arch.lbiu_clk));
+	printf("  Local Bus:           %-4s MHz\n",
+	       strmhz(buf, gd->arch.lclk_clk));
 	printf("  DDR:                 %-4s MHz\n", strmhz(buf, gd->mem_clk));
 #if defined(CONFIG_MPC8360)
-	printf("  DDR Secondary:       %-4s MHz\n", strmhz(buf, gd->mem_sec_clk));
+	printf("  DDR Secondary:       %-4s MHz\n",
+	       strmhz(buf, gd->arch.mem_sec_clk));
 #endif
 #if !defined(CONFIG_MPC8309)
-	printf("  SEC:                 %-4s MHz\n", strmhz(buf, gd->enc_clk));
+	printf("  SEC:                 %-4s MHz\n",
+	       strmhz(buf, gd->arch.enc_clk));
 #endif
 	printf("  I2C1:                %-4s MHz\n", strmhz(buf, gd->i2c1_clk));
 #if !defined(CONFIG_MPC832x)
 	printf("  I2C2:                %-4s MHz\n", strmhz(buf, gd->i2c2_clk));
 #endif
 #if defined(CONFIG_MPC8315)
-	printf("  TDM:                 %-4s MHz\n", strmhz(buf, gd->tdm_clk));
+	printf("  TDM:                 %-4s MHz\n",
+	       strmhz(buf, gd->arch.tdm_clk));
 #endif
 #if defined(CONFIG_FSL_ESDHC)
 	printf("  SDHC:                %-4s MHz\n", strmhz(buf, gd->sdhc_clk));
 #endif
 #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
 	defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x)
-	printf("  TSEC1:               %-4s MHz\n", strmhz(buf, gd->tsec1_clk));
-	printf("  TSEC2:               %-4s MHz\n", strmhz(buf, gd->tsec2_clk));
-	printf("  USB DR:              %-4s MHz\n", strmhz(buf, gd->usbdr_clk));
+	printf("  TSEC1:               %-4s MHz\n",
+	       strmhz(buf, gd->arch.tsec1_clk));
+	printf("  TSEC2:               %-4s MHz\n",
+	       strmhz(buf, gd->arch.tsec2_clk));
+	printf("  USB DR:              %-4s MHz\n",
+	       strmhz(buf, gd->arch.usbdr_clk));
 #elif defined(CONFIG_MPC8309)
-	printf("  USB DR:              %-4s MHz\n", strmhz(buf, gd->usbdr_clk));
+	printf("  USB DR:              %-4s MHz\n",
+	       strmhz(buf, gd->arch.usbdr_clk));
 #endif
 #if defined(CONFIG_MPC834x)
-	printf("  USB MPH:             %-4s MHz\n", strmhz(buf, gd->usbmph_clk));
+	printf("  USB MPH:             %-4s MHz\n",
+	       strmhz(buf, gd->arch.usbmph_clk));
 #endif
 #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
 	defined(CONFIG_MPC837x)
-	printf("  PCIEXP1:             %-4s MHz\n", strmhz(buf, gd->pciexp1_clk));
-	printf("  PCIEXP2:             %-4s MHz\n", strmhz(buf, gd->pciexp2_clk));
+	printf("  PCIEXP1:             %-4s MHz\n",
+	       strmhz(buf, gd->arch.pciexp1_clk));
+	printf("  PCIEXP2:             %-4s MHz\n",
+	       strmhz(buf, gd->arch.pciexp2_clk));
 #endif
 #if defined(CONFIG_MPC837x) || defined(CONFIG_MPC8315)
-	printf("  SATA:                %-4s MHz\n", strmhz(buf, gd->sata_clk));
+	printf("  SATA:                %-4s MHz\n",
+	       strmhz(buf, gd->arch.sata_clk));
 #endif
 	return 0;
 }
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 7d0115d..b7bb035 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -42,64 +42,59 @@ struct arch_global_data {
 #if defined(CONFIG_QE)
 	u32 brg_clk;
 #endif
-};
-
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct	global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	cpu_clk;	/* CPU clock in Hz! */
-	unsigned long	bus_clk;
-	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
-	unsigned long	pci_clk;
-#if defined(CONFIG_CPM2)
-	/* There are many clocks on the MPC8260 - see page 9-5 */
-	unsigned long	vco_out;
-	unsigned long	cpm_clk;
-	unsigned long	scc_clk;
-#endif
-	unsigned long   mem_clk;
+	/* TODO: sjg at chromium.org: Should these be unslgned long? */
 #if defined(CONFIG_MPC83xx)
 	/* There are other clocks in the MPC83XX */
 	u32 csb_clk;
-#if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
+# if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
 	defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x)
 	u32 tsec1_clk;
 	u32 tsec2_clk;
 	u32 usbdr_clk;
-#elif defined(CONFIG_MPC8309)
+# elif defined(CONFIG_MPC8309)
 	u32 usbdr_clk;
-#endif
-#if defined (CONFIG_MPC834x)
+# endif
+# if defined(CONFIG_MPC834x)
 	u32 usbmph_clk;
-#endif /* CONFIG_MPC834x */
-#if defined(CONFIG_MPC8315)
+# endif /* CONFIG_MPC834x */
+# if defined(CONFIG_MPC8315)
 	u32 tdm_clk;
-#endif
+# endif
 	u32 core_clk;
 	u32 enc_clk;
 	u32 lbiu_clk;
 	u32 lclk_clk;
-#if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
+# if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
 	defined(CONFIG_MPC837x)
 	u32 pciexp1_clk;
 	u32 pciexp2_clk;
-#endif
-#if defined(CONFIG_MPC837x) || defined(CONFIG_MPC8315)
+# endif
+# if defined(CONFIG_MPC837x) || defined(CONFIG_MPC8315)
 	u32 sata_clk;
+# endif
+# if defined(CONFIG_MPC8360)
+	u32 mem_sec_clk;
+# endif /* CONFIG_MPC8360 */
 #endif
-#if defined(CONFIG_MPC8360)
-	u32  mem_sec_clk;
-#endif /* CONFIG_MPC8360 */
-#endif
+};
+
+/*
+ * The following data structure is placed in some memory wich is
+ * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
+ * some locked parts of the data cache) to allow for a minimum set of
+ * global variables during system initialization (until we have set
+ * up the memory controller so that we can use RAM).
+ */
+
+typedef	struct	global_data {
+	bd_t		*bd;
+	unsigned long	flags;
+	unsigned int	baudrate;
+	unsigned long	cpu_clk;	/* CPU clock in Hz! */
+	unsigned long	bus_clk;
+	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
+	unsigned long pci_clk;
+	unsigned long   mem_clk;
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 18/57] ppc: Move lbc_clk and cpu to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (16 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 17/57] ppc: Move mpc83xx " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 19/57] ppc: m68k: Move i2c1_clk, i2c2_clk " Simon Glass
                   ` (39 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move these fields into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc85xx/cpu.c          |    2 +-
 arch/powerpc/cpu/mpc85xx/fdt.c          |    4 ++--
 arch/powerpc/cpu/mpc85xx/speed.c        |    2 +-
 arch/powerpc/cpu/mpc86xx/cpu.c          |    2 +-
 arch/powerpc/cpu/mpc86xx/fdt.c          |    4 ++--
 arch/powerpc/cpu/mpc86xx/speed.c        |    2 +-
 arch/powerpc/cpu/mpc8xxx/cpu.c          |    8 ++++----
 arch/powerpc/include/asm/global_data.h  |    8 ++++----
 arch/powerpc/lib/board.c                |    7 ++++---
 board/freescale/bsc9131rdb/bsc9131rdb.c |    2 +-
 board/freescale/corenet_ds/corenet_ds.c |    2 +-
 board/freescale/p1010rdb/ddr.c          |    6 +++---
 board/freescale/p1010rdb/p1010rdb.c     |    6 +++---
 board/freescale/p1_p2_rdb/ddr.c         |    2 +-
 board/freescale/p1_p2_rdb/p1_p2_rdb.c   |    2 +-
 board/freescale/p2041rdb/p2041rdb.c     |    2 +-
 board/freescale/t4qds/t4qds.c           |    2 +-
 17 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index db232e6..a8a83cd 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -104,7 +104,7 @@ int checkcpu (void)
 		puts("CPU:   ");
 	}
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 
 	puts(cpu->name);
 	if (IS_E_PROCESSOR(svr))
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index ab09330..6422e0f 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -613,9 +613,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 		"bus-frequency", bd->bi_busfreq, 1);
 
 	do_fixup_by_compat_u32(blob, "fsl,pq3-localbus",
-		"bus-frequency", gd->lbc_clk, 1);
+		"bus-frequency", gd->arch.lbc_clk, 1);
 	do_fixup_by_compat_u32(blob, "fsl,elbc",
-		"bus-frequency", gd->lbc_clk, 1);
+		"bus-frequency", gd->arch.lbc_clk, 1);
 #ifdef CONFIG_QE
 	ft_qe_setup(blob);
 	ft_fixup_qe_snum(blob);
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index c4ca481..f3132fb 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -391,7 +391,7 @@ int get_clocks (void)
 	gd->cpu_clk = sys_info.freqProcessor[0];
 	gd->bus_clk = sys_info.freqSystemBus;
 	gd->mem_clk = sys_info.freqDDRBus;
-	gd->lbc_clk = sys_info.freqLocalBus;
+	gd->arch.lbc_clk = sys_info.freqLocalBus;
 
 #ifdef CONFIG_QE
 	gd->qe_clk = sys_info.freqQE;
diff --git a/arch/powerpc/cpu/mpc86xx/cpu.c b/arch/powerpc/cpu/mpc86xx/cpu.c
index d2c8c78..c553415 100644
--- a/arch/powerpc/cpu/mpc86xx/cpu.c
+++ b/arch/powerpc/cpu/mpc86xx/cpu.c
@@ -67,7 +67,7 @@ checkcpu(void)
 	}
 	puts("CPU:   ");
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 
 	puts(cpu->name);
 
diff --git a/arch/powerpc/cpu/mpc86xx/fdt.c b/arch/powerpc/cpu/mpc86xx/fdt.c
index 2f955fe..26a65c5 100644
--- a/arch/powerpc/cpu/mpc86xx/fdt.c
+++ b/arch/powerpc/cpu/mpc86xx/fdt.c
@@ -34,10 +34,10 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 
 #if defined(CONFIG_MPC8641)
 	do_fixup_by_compat_u32(blob, "fsl,mpc8641-localbus",
-			       "bus-frequency", gd->lbc_clk, 1);
+			       "bus-frequency", gd->arch.lbc_clk, 1);
 #endif
 	do_fixup_by_compat_u32(blob, "fsl,elbc",
-			       "bus-frequency", gd->lbc_clk, 1);
+			       "bus-frequency", gd->arch.lbc_clk, 1);
 
 	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 
diff --git a/arch/powerpc/cpu/mpc86xx/speed.c b/arch/powerpc/cpu/mpc86xx/speed.c
index a2d0a8a..e5798ee 100644
--- a/arch/powerpc/cpu/mpc86xx/speed.c
+++ b/arch/powerpc/cpu/mpc86xx/speed.c
@@ -120,7 +120,7 @@ int get_clocks(void)
 	get_sys_info(&sys_info);
 	gd->cpu_clk = sys_info.freqProcessor;
 	gd->bus_clk = sys_info.freqSystemBus;
-	gd->lbc_clk = sys_info.freqLocalBus;
+	gd->arch.lbc_clk = sys_info.freqLocalBus;
 
 	/*
 	 * The base clock for I2C depends on the actual SOC.  Unfortunately,
diff --git a/arch/powerpc/cpu/mpc8xxx/cpu.c b/arch/powerpc/cpu/mpc8xxx/cpu.c
index e8613be..dcbb199 100644
--- a/arch/powerpc/cpu/mpc8xxx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xxx/cpu.c
@@ -146,7 +146,7 @@ struct cpu_type *identify_cpu(u32 ver)
 u32 cpu_mask(void)
 {
 	ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC8xxx_PIC_ADDR;
-	struct cpu_type *cpu = gd->cpu;
+	struct cpu_type *cpu = gd->arch.cpu;
 
 	/* better to query feature reporting register than just assume 1 */
 	if (cpu == &cpu_type_unknown)
@@ -164,7 +164,7 @@ u32 cpu_mask(void)
  */
 int cpu_numcores(void)
 {
-	struct cpu_type *cpu = gd->cpu;
+	struct cpu_type *cpu = gd->arch.cpu;
 
 	/*
 	 * Report # of cores in terms of the cpu_mask if we haven't
@@ -194,7 +194,7 @@ int probecpu (void)
 	svr = get_svr();
 	ver = SVR_SOC_VER(svr);
 
-	gd->cpu = identify_cpu(ver);
+	gd->arch.cpu = identify_cpu(ver);
 
 	return 0;
 }
@@ -202,7 +202,7 @@ int probecpu (void)
 /* Once in memory, compute mask & # cores once and save them off */
 int fixup_cpu(void)
 {
-	struct cpu_type *cpu = gd->cpu;
+	struct cpu_type *cpu = gd->arch.cpu;
 
 	if (cpu->num_cores == 0) {
 		cpu->mask = cpu_mask();
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index b7bb035..d924673 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -76,6 +76,10 @@ struct arch_global_data {
 	u32 mem_sec_clk;
 # endif /* CONFIG_MPC8360 */
 #endif
+#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
+	u32 lbc_clk;
+	void *cpu;
+#endif /* CONFIG_MPC85xx || CONFIG_MPC86xx */
 };
 
 /*
@@ -98,10 +102,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
-#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
-	u32 lbc_clk;
-	void *cpu;
-#endif /* CONFIG_MPC85xx || CONFIG_MPC86xx */
 #if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
 	u32 i2c1_clk;
 	u32 i2c2_clk;
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 517560a..6315991 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -649,10 +649,11 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
 	/*
-	 * The gd->cpu pointer is set to an address in flash before relocation.
-	 * We need to update it to point to the same CPU entry in RAM.
+	 * The gd->arch.cpu pointer is set to an address in flash before
+	 * relocation.  We need to update it to point to the same CPU entry
+	 * in RAM.
 	 */
-	gd->cpu += dest_addr - CONFIG_SYS_MONITOR_BASE;
+	gd->arch.cpu += dest_addr - CONFIG_SYS_MONITOR_BASE;
 
 	/*
 	 * If we didn't know the cpu mask & # cores, we can save them of
diff --git a/board/freescale/bsc9131rdb/bsc9131rdb.c b/board/freescale/bsc9131rdb/bsc9131rdb.c
index 2e0e55f..fe870b6 100644
--- a/board/freescale/bsc9131rdb/bsc9131rdb.c
+++ b/board/freescale/bsc9131rdb/bsc9131rdb.c
@@ -59,7 +59,7 @@ int checkboard(void)
 {
 	struct cpu_type *cpu;
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 	printf("Board: %sRDB\n", cpu->name);
 
 	return 0;
diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c
index a33c936..0312212 100644
--- a/board/freescale/corenet_ds/corenet_ds.c
+++ b/board/freescale/corenet_ds/corenet_ds.c
@@ -42,7 +42,7 @@ DECLARE_GLOBAL_DATA_PTR;
 int checkboard (void)
 {
 	u8 sw;
-	struct cpu_type *cpu = gd->cpu;
+	struct cpu_type *cpu = gd->arch.cpu;
 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 	unsigned int i;
 
diff --git a/board/freescale/p1010rdb/ddr.c b/board/freescale/p1010rdb/ddr.c
index 6d00caf..49310bd 100644
--- a/board/freescale/p1010rdb/ddr.c
+++ b/board/freescale/p1010rdb/ddr.c
@@ -99,7 +99,7 @@ unsigned long get_sdram_size(void)
 	struct cpu_type *cpu;
 	phys_size_t ddr_size;
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 	/* P1014 and it's derivatives support max 16it DDR width */
 	if (cpu->soc_ver == SVR_P1014)
 		ddr_size = (CONFIG_SYS_DRAM_SIZE / 2);
@@ -144,7 +144,7 @@ phys_size_t fixed_sdram(void)
 		panic("Unsupported DDR data rate %s MT/s data rate\n",
 					strmhz(buf, ddr_freq));
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 	/* P1014 and it's derivatives support max 16bit DDR width */
 	if (cpu->soc_ver == SVR_P1014) {
 		ddr_cfg_regs.ddr_sdram_cfg &= ~SDRAM_CFG_DBW_MASK;
@@ -237,7 +237,7 @@ void fsl_ddr_board_options(memctl_options_t *popts,
 	popts->trwt_override = 1;
 	popts->trwt = 0;
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 	/* P1014 and it's derivatives support max 16it DDR width */
 	if (cpu->soc_ver == SVR_P1014)
 		popts->data_bus_width = DDR_DATA_BUS_WIDTH_16;
diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c
index dfeb86f..11e2e8a 100644
--- a/board/freescale/p1010rdb/p1010rdb.c
+++ b/board/freescale/p1010rdb/p1010rdb.c
@@ -164,7 +164,7 @@ int checkboard(void)
 {
 	struct cpu_type *cpu;
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 	printf("Board: %sRDB\n", cpu->name);
 
 	return 0;
@@ -178,7 +178,7 @@ int board_eth_init(bd_t *bis)
 	struct cpu_type *cpu;
 	int num = 0;
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 
 #ifdef CONFIG_TSEC1
 	SET_STD_TSEC_INFO(tsec_info[num], 1);
@@ -283,7 +283,7 @@ void ft_board_setup(void *blob, bd_t *bd)
 	phys_size_t size;
 	struct cpu_type *cpu;
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 
 	ft_cpu_setup(blob, bd);
 
diff --git a/board/freescale/p1_p2_rdb/ddr.c b/board/freescale/p1_p2_rdb/ddr.c
index 916439c..b16b8c8 100644
--- a/board/freescale/p1_p2_rdb/ddr.c
+++ b/board/freescale/p1_p2_rdb/ddr.c
@@ -202,7 +202,7 @@ phys_size_t fixed_sdram (void)
 	struct cpu_type *cpu;
 	ulong ddr_freq, ddr_freq_mhz;
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 	/* P1020 and it's derivatives support max 32bit DDR width */
 	if (cpu->soc_ver == SVR_P1020 || cpu->soc_ver == SVR_P1011) {
 		ddr_size = (CONFIG_SYS_SDRAM_SIZE * 1024 * 1024 / 2);
diff --git a/board/freescale/p1_p2_rdb/p1_p2_rdb.c b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
index 437eaf0..9c6683d 100644
--- a/board/freescale/p1_p2_rdb/p1_p2_rdb.c
+++ b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
@@ -108,7 +108,7 @@ int checkboard (void)
 	else
 		panic ("Unexpected Board REV %x detected!!\n", board_rev_gpio);
 
-	cpu = gd->cpu;
+	cpu = gd->arch.cpu;
 	printf ("Board: %sRDB Rev%c\n", cpu->name, board_rev);
 
 	setbits_be32(&pgpio->gpdir, GPIO_DIR);
diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c
index d2732f5..19d31c8 100644
--- a/board/freescale/p2041rdb/p2041rdb.c
+++ b/board/freescale/p2041rdb/p2041rdb.c
@@ -43,7 +43,7 @@ DECLARE_GLOBAL_DATA_PTR;
 int checkboard(void)
 {
 	u8 sw;
-	struct cpu_type *cpu = gd->cpu;
+	struct cpu_type *cpu = gd->arch.cpu;
 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 	unsigned int i;
 
diff --git a/board/freescale/t4qds/t4qds.c b/board/freescale/t4qds/t4qds.c
index 88b8ced..6f2f503 100644
--- a/board/freescale/t4qds/t4qds.c
+++ b/board/freescale/t4qds/t4qds.c
@@ -45,7 +45,7 @@ DECLARE_GLOBAL_DATA_PTR;
 int checkboard(void)
 {
 	u8 sw;
-	struct cpu_type *cpu = gd->cpu;
+	struct cpu_type *cpu = gd->arch.cpu;
 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 	unsigned int i;
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 19/57] ppc: m68k: Move i2c1_clk, i2c2_clk to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (17 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 18/57] ppc: Move lbc_clk and cpu " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 20/57] ppc: Move CONFIG_QE " Simon Glass
                   ` (38 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move these fields into arch_global_data and tidy up. This is needed for
both ppc and m68k since they share the i2c driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/m68k/cpu/mcf5227x/speed.c         |    2 +-
 arch/m68k/cpu/mcf523x/speed.c          |    2 +-
 arch/m68k/cpu/mcf52x2/speed.c          |    4 ++--
 arch/m68k/cpu/mcf532x/speed.c          |    2 +-
 arch/m68k/cpu/mcf5445x/speed.c         |    4 ++--
 arch/m68k/cpu/mcf547x_8x/speed.c       |    2 +-
 arch/m68k/include/asm/global_data.h    |    8 ++++----
 arch/powerpc/cpu/mpc83xx/speed.c       |   10 ++++++----
 arch/powerpc/cpu/mpc85xx/speed.c       |   10 +++++-----
 arch/powerpc/cpu/mpc86xx/speed.c       |    6 +++---
 arch/powerpc/include/asm/global_data.h |    9 +++++----
 drivers/i2c/fsl_i2c.c                  |    7 ++++---
 12 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/arch/m68k/cpu/mcf5227x/speed.c b/arch/m68k/cpu/mcf5227x/speed.c
index b94a9ed..c1d5930 100644
--- a/arch/m68k/cpu/mcf5227x/speed.c
+++ b/arch/m68k/cpu/mcf5227x/speed.c
@@ -135,7 +135,7 @@ int get_clocks(void)
 	}
 
 #ifdef CONFIG_FSL_I2C
-	gd->i2c1_clk = gd->bus_clk;
+	gd->arch.i2c1_clk = gd->bus_clk;
 #endif
 
 	return (0);
diff --git a/arch/m68k/cpu/mcf523x/speed.c b/arch/m68k/cpu/mcf523x/speed.c
index e2a6ae3..ae46257 100644
--- a/arch/m68k/cpu/mcf523x/speed.c
+++ b/arch/m68k/cpu/mcf523x/speed.c
@@ -48,7 +48,7 @@ int get_clocks(void)
 	gd->cpu_clk = (gd->bus_clk * 2);
 
 #ifdef CONFIG_FSL_I2C
-	gd->i2c1_clk = gd->bus_clk;
+	gd->arch.i2c1_clk = gd->bus_clk;
 #endif
 
 	return (0);
diff --git a/arch/m68k/cpu/mcf52x2/speed.c b/arch/m68k/cpu/mcf52x2/speed.c
index 70abed2..ba7dbaa 100644
--- a/arch/m68k/cpu/mcf52x2/speed.c
+++ b/arch/m68k/cpu/mcf52x2/speed.c
@@ -91,9 +91,9 @@ int get_clocks (void)
 #endif
 
 #ifdef CONFIG_FSL_I2C
-	gd->i2c1_clk = gd->bus_clk;
+	gd->arch.i2c1_clk = gd->bus_clk;
 #ifdef CONFIG_SYS_I2C2_OFFSET
-	gd->i2c2_clk = gd->bus_clk;
+	gd->arch.i2c2_clk = gd->bus_clk;
 #endif
 #endif
 
diff --git a/arch/m68k/cpu/mcf532x/speed.c b/arch/m68k/cpu/mcf532x/speed.c
index cfdcc8b..8efb451 100644
--- a/arch/m68k/cpu/mcf532x/speed.c
+++ b/arch/m68k/cpu/mcf532x/speed.c
@@ -271,7 +271,7 @@ int get_clocks(void)
 	gd->cpu_clk = (gd->bus_clk * 3);
 
 #ifdef CONFIG_FSL_I2C
-	gd->i2c1_clk = gd->bus_clk;
+	gd->arch.i2c1_clk = gd->bus_clk;
 #endif
 
 	return (0);
diff --git a/arch/m68k/cpu/mcf5445x/speed.c b/arch/m68k/cpu/mcf5445x/speed.c
index 55d1c48..b7dbc65 100644
--- a/arch/m68k/cpu/mcf5445x/speed.c
+++ b/arch/m68k/cpu/mcf5445x/speed.c
@@ -274,7 +274,7 @@ void setup_5445x_clocks(void)
 	}
 
 #ifdef CONFIG_FSL_I2C
-	gd->i2c1_clk = gd->bus_clk;
+	gd->arch.i2c1_clk = gd->bus_clk;
 #endif
 }
 #endif
@@ -290,7 +290,7 @@ int get_clocks(void)
 #endif
 
 #ifdef CONFIG_FSL_I2C
-	gd->i2c1_clk = gd->bus_clk;
+	gd->arch.i2c1_clk = gd->bus_clk;
 #endif
 
 	return (0);
diff --git a/arch/m68k/cpu/mcf547x_8x/speed.c b/arch/m68k/cpu/mcf547x_8x/speed.c
index 31130b5..41aae9d 100644
--- a/arch/m68k/cpu/mcf547x_8x/speed.c
+++ b/arch/m68k/cpu/mcf547x_8x/speed.c
@@ -41,7 +41,7 @@ int get_clocks(void)
 	gd->cpu_clk = (gd->bus_clk * 2);
 
 #ifdef CONFIG_FSL_I2C
-	gd->i2c1_clk = gd->bus_clk;
+	gd->arch.i2c1_clk = gd->bus_clk;
 #endif
 
 	return (0);
diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h
index fd8aacb..d9be8b1 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -26,6 +26,10 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+#ifdef CONFIG_FSL_I2C
+	unsigned long	i2c1_clk;
+	unsigned long	i2c2_clk;
+#endif
 };
 
 /*
@@ -50,10 +54,6 @@ typedef	struct	global_data {
 	unsigned long	vco_clk;
 	unsigned long	flb_clk;
 #endif
-#ifdef CONFIG_FSL_I2C
-	unsigned long	i2c1_clk;
-	unsigned long	i2c2_clk;
-#endif
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	reset_status;	/* reset status register at boot	*/
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index 7f98ee8..a40a055 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -481,9 +481,9 @@ int get_clocks(void)
 	gd->sdhc_clk = sdhc_clk;
 #endif
 	gd->arch.core_clk = core_clk;
-	gd->i2c1_clk = i2c1_clk;
+	gd->arch.i2c1_clk = i2c1_clk;
 #if !defined(CONFIG_MPC832x)
-	gd->i2c2_clk = i2c2_clk;
+	gd->arch.i2c2_clk = i2c2_clk;
 #endif
 #if !defined(CONFIG_MPC8309)
 	gd->arch.enc_clk = enc_clk;
@@ -558,9 +558,11 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	printf("  SEC:                 %-4s MHz\n",
 	       strmhz(buf, gd->arch.enc_clk));
 #endif
-	printf("  I2C1:                %-4s MHz\n", strmhz(buf, gd->i2c1_clk));
+	printf("  I2C1:                %-4s MHz\n",
+	       strmhz(buf, gd->arch.i2c1_clk));
 #if !defined(CONFIG_MPC832x)
-	printf("  I2C2:                %-4s MHz\n", strmhz(buf, gd->i2c2_clk));
+	printf("  I2C2:                %-4s MHz\n",
+	       strmhz(buf, gd->arch.i2c2_clk));
 #endif
 #if defined(CONFIG_MPC8315)
 	printf("  TDM:                 %-4s MHz\n",
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index f3132fb..81c80e7 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -406,7 +406,7 @@ int get_clocks (void)
 	 */
 #if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
 	defined(CONFIG_MPC8560) || defined(CONFIG_MPC8555)
-	gd->i2c1_clk = sys_info.freqSystemBus;
+	gd->arch.i2c1_clk = sys_info.freqSystemBus;
 #elif defined(CONFIG_MPC8544)
 	/*
 	 * On the 8544, the I2C clock is the same as the SEC clock.  This can be
@@ -416,14 +416,14 @@ int get_clocks (void)
 	 * PORDEVSR2_SEC_CFG bit is 0 on all 85xx boards that are not an 8544.
 	 */
 	if (gur->pordevsr2 & MPC85xx_PORDEVSR2_SEC_CFG)
-		gd->i2c1_clk = sys_info.freqSystemBus / 3;
+		gd->arch.i2c1_clk = sys_info.freqSystemBus / 3;
 	else
-		gd->i2c1_clk = sys_info.freqSystemBus / 2;
+		gd->arch.i2c1_clk = sys_info.freqSystemBus / 2;
 #else
 	/* Most 85xx SOCs use CCB/2, so this is the default behavior. */
-	gd->i2c1_clk = sys_info.freqSystemBus / 2;
+	gd->arch.i2c1_clk = sys_info.freqSystemBus / 2;
 #endif
-	gd->i2c2_clk = gd->i2c1_clk;
+	gd->arch.i2c2_clk = gd->arch.i2c1_clk;
 
 #if defined(CONFIG_FSL_ESDHC)
 #if defined(CONFIG_MPC8569) || defined(CONFIG_P1010) ||\
diff --git a/arch/powerpc/cpu/mpc86xx/speed.c b/arch/powerpc/cpu/mpc86xx/speed.c
index e5798ee..18c1eea 100644
--- a/arch/powerpc/cpu/mpc86xx/speed.c
+++ b/arch/powerpc/cpu/mpc86xx/speed.c
@@ -130,11 +130,11 @@ int get_clocks(void)
 	 * AN2919.
 	 */
 #ifdef CONFIG_MPC8610
-	gd->i2c1_clk = sys_info.freqSystemBus;
+	gd->arch.i2c1_clk = sys_info.freqSystemBus;
 #else
-	gd->i2c1_clk = sys_info.freqSystemBus / 2;
+	gd->arch.i2c1_clk = sys_info.freqSystemBus / 2;
 #endif
-	gd->i2c2_clk = gd->i2c1_clk;
+	gd->arch.i2c2_clk = gd->arch.i2c1_clk;
 
 	if (gd->cpu_clk != 0)
 		return 0;
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index d924673..b710f25 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -80,6 +80,11 @@ struct arch_global_data {
 	u32 lbc_clk;
 	void *cpu;
 #endif /* CONFIG_MPC85xx || CONFIG_MPC86xx */
+#if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \
+		defined(CONFIG_MPC86xx)
+	u32 i2c1_clk;
+	u32 i2c2_clk;
+#endif
 };
 
 /*
@@ -102,10 +107,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
-#if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
-	u32 i2c1_clk;
-	u32 i2c2_clk;
-#endif
 #if defined(CONFIG_QE)
 	u32 qe_clk;
 	uint mp_alloc_base;
diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index 3cb232f..1c7265d 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -217,9 +217,9 @@ static unsigned int set_i2c_bus_speed(const struct fsl_i2c *dev,
 static unsigned int get_i2c_clock(int bus)
 {
 	if (bus)
-		return gd->i2c2_clk;	/* I2C2 clock */
+		return gd->arch.i2c2_clk;	/* I2C2 clock */
 	else
-		return gd->i2c1_clk;	/* I2C1 clock */
+		return gd->arch.i2c1_clk;	/* I2C1 clock */
 }
 
 void
@@ -468,7 +468,8 @@ int i2c_set_bus_num(unsigned int bus)
 
 int i2c_set_bus_speed(unsigned int speed)
 {
-	unsigned int i2c_clk = (i2c_bus_num == 1) ? gd->i2c2_clk : gd->i2c1_clk;
+	unsigned int i2c_clk = (i2c_bus_num == 1)
+			? gd->arch.i2c2_clk : gd->arch.i2c1_clk;
 
 	writeb(0, &i2c_dev[i2c_bus_num]->cr);		/* stop controller */
 	i2c_bus_speed[i2c_bus_num] =
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 20/57] ppc: Move CONFIG_QE to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (18 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 19/57] ppc: m68k: Move i2c1_clk, i2c2_clk " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 21/57] ppc: Move used_laws " Simon Glass
                   ` (37 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move the quantative easing fields into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc83xx/speed.c       |    5 +++--
 arch/powerpc/cpu/mpc85xx/speed.c       |    4 ++--
 arch/powerpc/include/asm/global_data.h |   14 ++++++--------
 drivers/qe/fdt.c                       |    8 ++++----
 drivers/qe/qe.c                        |   19 ++++++++++---------
 5 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index a40a055..ba8b285 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -495,7 +495,7 @@ int get_clocks(void)
 	gd->arch.mem_sec_clk = mem_sec_clk;
 #endif
 #if defined(CONFIG_QE)
-	gd->qe_clk = qe_clk;
+	gd->arch.qe_clk = qe_clk;
 	gd->arch.brg_clk = brg_clk;
 #endif
 #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
@@ -541,7 +541,8 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	printf("  Coherent System Bus: %-4s MHz\n",
 	       strmhz(buf, gd->arch.csb_clk));
 #if defined(CONFIG_QE)
-	printf("  QE:                  %-4s MHz\n", strmhz(buf, gd->qe_clk));
+	printf("  QE:                  %-4s MHz\n",
+	       strmhz(buf, gd->arch.qe_clk));
 	printf("  BRG:                 %-4s MHz\n",
 	       strmhz(buf, gd->arch.brg_clk));
 #endif
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index 81c80e7..7173c07 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -394,8 +394,8 @@ int get_clocks (void)
 	gd->arch.lbc_clk = sys_info.freqLocalBus;
 
 #ifdef CONFIG_QE
-	gd->qe_clk = sys_info.freqQE;
-	gd->arch.brg_clk = gd->qe_clk / 2;
+	gd->arch.qe_clk = sys_info.freqQE;
+	gd->arch.brg_clk = gd->arch.qe_clk / 2;
 #endif
 	/*
 	 * The base clock for I2C depends on the actual SOC.  Unfortunately,
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index b710f25..760cdab 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -39,9 +39,6 @@ struct arch_global_data {
 	unsigned long scc_clk;
 	unsigned long brg_clk;
 #endif
-#if defined(CONFIG_QE)
-	u32 brg_clk;
-#endif
 	/* TODO: sjg at chromium.org: Should these be unslgned long? */
 #if defined(CONFIG_MPC83xx)
 	/* There are other clocks in the MPC83XX */
@@ -85,6 +82,12 @@ struct arch_global_data {
 	u32 i2c1_clk;
 	u32 i2c2_clk;
 #endif
+#if defined(CONFIG_QE)
+	u32 qe_clk;
+	u32 brg_clk;
+	uint mp_alloc_base;
+	uint mp_alloc_top;
+#endif /* CONFIG_QE */
 };
 
 /*
@@ -107,11 +110,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
-#if defined(CONFIG_QE)
-	u32 qe_clk;
-	uint mp_alloc_base;
-	uint mp_alloc_top;
-#endif /* CONFIG_QE */
 #if defined(CONFIG_FSL_LAW)
 	u32 used_laws;
 #endif
diff --git a/drivers/qe/fdt.c b/drivers/qe/fdt.c
index 1a123b8..5a0f277 100644
--- a/drivers/qe/fdt.c
+++ b/drivers/qe/fdt.c
@@ -75,16 +75,16 @@ error:
 void ft_qe_setup(void *blob)
 {
 	do_fixup_by_prop_u32(blob, "device_type", "qe", 4,
-		"bus-frequency", gd->qe_clk, 1);
+		"bus-frequency", gd->arch.qe_clk, 1);
 	do_fixup_by_prop_u32(blob, "device_type", "qe", 4,
 		"brg-frequency", gd->arch.brg_clk, 1);
 	do_fixup_by_compat_u32(blob, "fsl,qe",
-		"clock-frequency", gd->qe_clk, 1);
+		"clock-frequency", gd->arch.qe_clk, 1);
 	do_fixup_by_compat_u32(blob, "fsl,qe",
-		"bus-frequency", gd->qe_clk, 1);
+		"bus-frequency", gd->arch.qe_clk, 1);
 	do_fixup_by_compat_u32(blob, "fsl,qe",
 		"brg-frequency", gd->arch.brg_clk, 1);
 	do_fixup_by_compat_u32(blob, "fsl,qe-gtm",
-		"clock-frequency", gd->qe_clk / 2, 1);
+		"clock-frequency", gd->arch.qe_clk / 2, 1);
 	fdt_fixup_qe_firmware(blob);
 }
diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
index 72c585c..5fd2135 100644
--- a/drivers/qe/qe.c
+++ b/drivers/qe/qe.c
@@ -58,21 +58,22 @@ uint qe_muram_alloc(uint size, uint align)
 	uint	savebase;
 
 	align_mask = align - 1;
-	savebase = gd->mp_alloc_base;
+	savebase = gd->arch.mp_alloc_base;
 
-	if ((off = (gd->mp_alloc_base & align_mask)) != 0)
-		gd->mp_alloc_base += (align - off);
+	off = gd->arch.mp_alloc_base & align_mask;
+	if (off != 0)
+		gd->arch.mp_alloc_base += (align - off);
 
 	if ((off = size & align_mask) != 0)
 		size += (align - off);
 
-	if ((gd->mp_alloc_base + size) >= gd->mp_alloc_top) {
-		gd->mp_alloc_base = savebase;
+	if ((gd->arch.mp_alloc_base + size) >= gd->arch.mp_alloc_top) {
+		gd->arch.mp_alloc_base = savebase;
 		printf("%s: ran out of ram.\n",  __FUNCTION__);
 	}
 
-	retloc = gd->mp_alloc_base;
-	gd->mp_alloc_base += size;
+	retloc = gd->arch.mp_alloc_base;
+	gd->arch.mp_alloc_base += size;
 
 	memset((void *)&qe_immr->muram[retloc], 0, size);
 
@@ -183,8 +184,8 @@ void qe_init(uint qe_base)
 	out_be32(&qe_immr->iram.iready,QE_IRAM_READY);
 #endif
 
-	gd->mp_alloc_base = QE_DATAONLY_BASE;
-	gd->mp_alloc_top = gd->mp_alloc_base + QE_DATAONLY_SIZE;
+	gd->arch.mp_alloc_base = QE_DATAONLY_BASE;
+	gd->arch.mp_alloc_top = gd->arch.mp_alloc_base + QE_DATAONLY_SIZE;
 
 	qe_sdma_init();
 	qe_snums_init();
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 21/57] ppc: Move used_laws to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (19 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 20/57] ppc: Move CONFIG_QE " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 22/57] ppc: Move used_tlb_cams " Simon Glass
                   ` (36 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/include/asm/global_data.h |    6 +++---
 drivers/misc/fsl_law.c                 |   16 ++++++++--------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 760cdab..c7ce7fd 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -88,6 +88,9 @@ struct arch_global_data {
 	uint mp_alloc_base;
 	uint mp_alloc_top;
 #endif /* CONFIG_QE */
+#if defined(CONFIG_FSL_LAW)
+	u32 used_laws;
+#endif
 };
 
 /*
@@ -110,9 +113,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
-#if defined(CONFIG_FSL_LAW)
-	u32 used_laws;
-#endif
 #if defined(CONFIG_E500)
 	u32 used_tlb_cams[(CONFIG_SYS_NUM_TLBCAMS+31)/32];
 #endif
diff --git a/drivers/misc/fsl_law.c b/drivers/misc/fsl_law.c
index 223cd5d..3bd21e8 100644
--- a/drivers/misc/fsl_law.c
+++ b/drivers/misc/fsl_law.c
@@ -69,7 +69,7 @@ static inline void set_law_base_addr(int idx, phys_addr_t addr)
 
 void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 {
-	gd->used_laws |= (1 << idx);
+	gd->arch.used_laws |= (1 << idx);
 
 	out_be32(LAWAR_ADDR(idx), 0);
 	set_law_base_addr(idx, addr);
@@ -81,7 +81,7 @@ void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 
 void disable_law(u8 idx)
 {
-	gd->used_laws &= ~(1 << idx);
+	gd->arch.used_laws &= ~(1 << idx);
 
 	out_be32(LAWAR_ADDR(idx), 0);
 	set_law_base_addr(idx, 0);
@@ -112,7 +112,7 @@ static int get_law_entry(u8 i, struct law_entry *e)
 
 int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 {
-	u32 idx = ffz(gd->used_laws);
+	u32 idx = ffz(gd->arch.used_laws);
 
 	if (idx >= FSL_HW_NUM_LAWS)
 		return -1;
@@ -128,11 +128,11 @@ int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 	u32 idx;
 
 	/* we have no LAWs free */
-	if (gd->used_laws == -1)
+	if (gd->arch.used_laws == -1)
 		return -1;
 
 	/* grab the last free law */
-	idx = __ilog2(~(gd->used_laws));
+	idx = __ilog2(~(gd->arch.used_laws));
 
 	if (idx >= FSL_HW_NUM_LAWS)
 		return -1;
@@ -240,9 +240,9 @@ void init_laws(void)
 	int i;
 
 #if FSL_HW_NUM_LAWS < 32
-	gd->used_laws = ~((1 << FSL_HW_NUM_LAWS) - 1);
+	gd->arch.used_laws = ~((1 << FSL_HW_NUM_LAWS) - 1);
 #elif FSL_HW_NUM_LAWS == 32
-	gd->used_laws = 0;
+	gd->arch.used_laws = 0;
 #else
 #error FSL_HW_NUM_LAWS can not be greater than 32 w/o code changes
 #endif
@@ -255,7 +255,7 @@ void init_laws(void)
 		u32 lawar = in_be32(LAWAR_ADDR(i));
 
 		if (lawar & LAW_EN)
-			gd->used_laws |= (1 << i);
+			gd->arch.used_laws |= (1 << i);
 	}
 
 #if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 22/57] ppc: Move used_tlb_cams to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (20 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 21/57] ppc: Move used_laws " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 23/57] ppc: Move mpc5xxx clocks " Simon Glass
                   ` (35 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc85xx/tlb.c         |    8 ++++----
 arch/powerpc/include/asm/global_data.h |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/tlb.c b/arch/powerpc/cpu/mpc85xx/tlb.c
index a548dec..bee8fc5 100644
--- a/arch/powerpc/cpu/mpc85xx/tlb.c
+++ b/arch/powerpc/cpu/mpc85xx/tlb.c
@@ -99,7 +99,7 @@ static inline void use_tlb_cam(u8 idx)
 	int i = idx / 32;
 	int bit = idx % 32;
 
-	gd->used_tlb_cams[i] |= (1 << bit);
+	gd->arch.used_tlb_cams[i] |= (1 << bit);
 }
 
 static inline void free_tlb_cam(u8 idx)
@@ -107,7 +107,7 @@ static inline void free_tlb_cam(u8 idx)
 	int i = idx / 32;
 	int bit = idx % 32;
 
-	gd->used_tlb_cams[i] &= ~(1 << bit);
+	gd->arch.used_tlb_cams[i] &= ~(1 << bit);
 }
 
 void init_used_tlb_cams(void)
@@ -116,7 +116,7 @@ void init_used_tlb_cams(void)
 	unsigned int num_cam = mfspr(SPRN_TLB1CFG) & 0xfff;
 
 	for (i = 0; i < ((CONFIG_SYS_NUM_TLBCAMS+31)/32); i++)
-		gd->used_tlb_cams[i] = 0;
+		gd->arch.used_tlb_cams[i] = 0;
 
 	/* walk all the entries */
 	for (i = 0; i < num_cam; i++) {
@@ -133,7 +133,7 @@ int find_free_tlbcam(void)
 	u32 idx;
 
 	for (i = 0; i < ((CONFIG_SYS_NUM_TLBCAMS+31)/32); i++) {
-		idx = ffz(gd->used_tlb_cams[i]);
+		idx = ffz(gd->arch.used_tlb_cams[i]);
 
 		if (idx != 32)
 			break;
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index c7ce7fd..ca36ca3 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -91,6 +91,9 @@ struct arch_global_data {
 #if defined(CONFIG_FSL_LAW)
 	u32 used_laws;
 #endif
+#if defined(CONFIG_E500)
+	u32 used_tlb_cams[(CONFIG_SYS_NUM_TLBCAMS+31)/32];
+#endif
 };
 
 /*
@@ -113,9 +116,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
-#if defined(CONFIG_E500)
-	u32 used_tlb_cams[(CONFIG_SYS_NUM_TLBCAMS+31)/32];
-#endif
 #if defined(CONFIG_MPC5xxx)
 	unsigned long	ipb_clk;
 #endif
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 23/57] ppc: Move mpc5xxx clocks to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (21 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 22/57] ppc: Move used_tlb_cams " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 24/57] ppc: Move mpc512x " Simon Glass
                   ` (34 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move ipb_clk and pci_clk into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc5xxx/i2c.c         |    2 +-
 arch/powerpc/cpu/mpc5xxx/ide.c         |    2 +-
 arch/powerpc/cpu/mpc5xxx/serial.c      |    4 ++--
 arch/powerpc/cpu/mpc5xxx/speed.c       |   18 ++++++++++++------
 arch/powerpc/cpu/mpc8220/fec.c         |    8 +++++---
 arch/powerpc/include/asm/global_data.h |    6 +++---
 arch/powerpc/lib/board.c               |    2 +-
 board/inka4x0/inkadiag.c               |    8 ++++----
 drivers/input/ps2ser.c                 |    2 +-
 drivers/net/mpc5xxx_fec.c              |    9 ++++++---
 10 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/cpu/mpc5xxx/i2c.c b/arch/powerpc/cpu/mpc5xxx/i2c.c
index b423d2f..8d5f47b 100644
--- a/arch/powerpc/cpu/mpc5xxx/i2c.c
+++ b/arch/powerpc/cpu/mpc5xxx/i2c.c
@@ -310,7 +310,7 @@ static int mpc_get_fdr(int speed)
 			{126, 128}
 		};
 
-		ipb = gd->ipb_clk;
+		ipb = gd->arch.ipb_clk;
 		for (i = 7; i >= 0; i--) {
 			for (j = 7; j >= 0; j--) {
 				scl = 2 * (scltap[j].scl2tap +
diff --git a/arch/powerpc/cpu/mpc5xxx/ide.c b/arch/powerpc/cpu/mpc5xxx/ide.c
index d337abb..094f62b 100644
--- a/arch/powerpc/cpu/mpc5xxx/ide.c
+++ b/arch/powerpc/cpu/mpc5xxx/ide.c
@@ -75,7 +75,7 @@ int ide_preinit (void)
 	psdma->PtdCntrl |= 1;
 
 	/* Init timings : we use PIO mode 0 timings */
-	period = 1000000000 / gd->ipb_clk;	/* period in ns */
+	period = 1000000000 / gd->arch.ipb_clk;	/* period in ns */
 
 	t0 = CALC_TIMING (600);
 	t2_8 = CALC_TIMING (290);
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c b/arch/powerpc/cpu/mpc5xxx/serial.c
index eb14161..1ccb4e3 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -89,7 +89,7 @@ int serial_init_dev (unsigned long dev_base)
 
 	/* select clock sources */
 	psc->psc_clock_select = 0;
-	baseclk = (gd->ipb_clk + 16) / 32;
+	baseclk = (gd->arch.ipb_clk + 16) / 32;
 
 	/* switch to UART mode */
 	psc->sicr = 0;
@@ -169,7 +169,7 @@ void serial_setbrg_dev (unsigned long dev_base)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
 	unsigned long baseclk, div;
 
-	baseclk = (gd->ipb_clk + 16) / 32;
+	baseclk = (gd->arch.ipb_clk + 16) / 32;
 
 	/* set up UART divisor */
 	div = (baseclk + (gd->baudrate/2)) / gd->baudrate;
diff --git a/arch/powerpc/cpu/mpc5xxx/speed.c b/arch/powerpc/cpu/mpc5xxx/speed.c
index 8027d3e..5353e3d 100644
--- a/arch/powerpc/cpu/mpc5xxx/speed.c
+++ b/arch/powerpc/cpu/mpc5xxx/speed.c
@@ -66,14 +66,20 @@ int get_clocks (void)
 
 	val = *(vu_long *)MPC5XXX_CDM_CFG;
 	if (val & (1 << 8)) {
-		gd->ipb_clk = gd->bus_clk / 2;
+		gd->arch.ipb_clk = gd->bus_clk / 2;
 	} else {
-		gd->ipb_clk = gd->bus_clk;
+		gd->arch.ipb_clk = gd->bus_clk;
 	}
 	switch (val & 3) {
-		case 0: gd->pci_clk = gd->ipb_clk; break;
-		case 1: gd->pci_clk = gd->ipb_clk / 2; break;
-		default: gd->pci_clk = gd->bus_clk / 4; break;
+	case 0:
+		gd->pci_clk = gd->arch.ipb_clk;
+		break;
+	case 1:
+		gd->pci_clk = gd->arch.ipb_clk / 2;
+		break;
+	default:
+		gd->pci_clk = gd->bus_clk / 4;
+		break;
 	}
 
 	return (0);
@@ -85,7 +91,7 @@ int prt_mpc5xxx_clks (void)
 
 	printf ("       Bus %s MHz, IPB %s MHz, PCI %s MHz\n",
 		strmhz(buf1, gd->bus_clk),
-		strmhz(buf2, gd->ipb_clk),
+		strmhz(buf2, gd->arch.ipb_clk),
 		strmhz(buf3, gd->pci_clk)
 	);
 	return (0);
diff --git a/arch/powerpc/cpu/mpc8220/fec.c b/arch/powerpc/cpu/mpc8220/fec.c
index aaf9be1..43fa802 100644
--- a/arch/powerpc/cpu/mpc8220/fec.c
+++ b/arch/powerpc/cpu/mpc8220/fec.c
@@ -288,9 +288,11 @@ static int mpc8220_fec_init (struct eth_device *dev, bd_t * bis)
 		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
 		 * and do not drop the Preamble.
 		 */
-		/* tbd - rtm */
-		/*fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); */
-		/* No MII for 7-wire mode */
+		/*
+		 * tbd - rtm
+		 * fec->eth->mii_speed = (((gd->arch.ipb_clk >> 20) / 5) << 1);
+		 * No MII for 7-wire mode
+		 */
 		fec->eth->mii_speed = 0x00000030;
 	}
 
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index ca36ca3..423e792 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -94,6 +94,9 @@ struct arch_global_data {
 #if defined(CONFIG_E500)
 	u32 used_tlb_cams[(CONFIG_SYS_NUM_TLBCAMS+31)/32];
 #endif
+#if defined(CONFIG_MPC5xxx)
+	unsigned long ipb_clk;
+#endif
 };
 
 /*
@@ -116,9 +119,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
-#if defined(CONFIG_MPC5xxx)
-	unsigned long	ipb_clk;
-#endif
 #if defined(CONFIG_MPC512X)
 	u32 ips_clk;
 	u32 csb_clk;
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 6315991..07b16d5 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -589,7 +589,7 @@ void board_init_f(ulong bootflag)
 	bd->bi_ipsfreq = gd->ips_clk;
 #endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC5xxx)
-	bd->bi_ipbfreq = gd->ipb_clk;
+	bd->bi_ipbfreq = gd->arch.ipb_clk;
 	bd->bi_pcifreq = gd->pci_clk;
 #endif /* CONFIG_MPC5xxx */
 	bd->bi_baudrate = gd->baudrate;	/* Console Baudrate     */
diff --git a/board/inka4x0/inkadiag.c b/board/inka4x0/inkadiag.c
index cf82f61..1c01bb4 100644
--- a/board/inka4x0/inkadiag.c
+++ b/board/inka4x0/inkadiag.c
@@ -187,7 +187,7 @@ static int ser_init(volatile struct mpc5xxx_psc *psc, int baudrate)
 	/* select clock sources */
 
 	out_be16(&psc->psc_clock_select, 0);
-	baseclk = (gd->ipb_clk + 16) / 32;
+	baseclk = (gd->arch.ipb_clk + 16) / 32;
 
 	/* switch to UART mode */
 	out_be32(&psc->sicr, 0);
@@ -369,7 +369,7 @@ static void buzzer_turn_on(unsigned int freq)
 {
 	volatile struct mpc5xxx_gpt *gpt = (struct mpc5xxx_gpt *)(BUZZER_GPT);
 
-	const u32 prescale = gd->ipb_clk / freq / 128;
+	const u32 prescale = gd->arch.ipb_clk / freq / 128;
 	const u32 count = 128;
 	const u32 width = 64;
 
@@ -405,9 +405,9 @@ static int do_inkadiag_buzzer(cmd_tbl_t *cmdtp, int flag, int argc,
 
 	freq = simple_strtol(argv[0], NULL, 0);
 	/* avoid zero prescale in buzzer_turn_on() */
-	if (freq > gd->ipb_clk / 128) {
+	if (freq > gd->arch.ipb_clk / 128) {
 		printf("%dHz exceeds maximum (%ldHz)\n", freq,
-		       gd->ipb_clk / 128);
+		       gd->arch.ipb_clk / 128);
 	} else if (!freq)
 		printf("Zero frequency is senseless\n");
 	else
diff --git a/drivers/input/ps2ser.c b/drivers/input/ps2ser.c
index a655a16..bcbe52a 100644
--- a/drivers/input/ps2ser.c
+++ b/drivers/input/ps2ser.c
@@ -80,7 +80,7 @@ int ps2ser_init(void)
 
 	/* select clock sources */
 	psc->psc_clock_select = 0;
-	baseclk = (gd->ipb_clk + 16) / 32;
+	baseclk = (gd->arch.ipb_clk + 16) / 32;
 
 	/* switch to UART mode */
 	psc->sicr = 0;
diff --git a/drivers/net/mpc5xxx_fec.c b/drivers/net/mpc5xxx_fec.c
index 3d180db..1093ba5 100644
--- a/drivers/net/mpc5xxx_fec.c
+++ b/drivers/net/mpc5xxx_fec.c
@@ -440,8 +440,9 @@ static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
 		/*
 		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
 		 * and do not drop the Preamble.
+		 * No MII for 7-wire mode
 		 */
-		fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1);	/* No MII for 7-wire mode */
+		fec->eth->mii_speed = (((gd->arch.ipb_clk >> 20) / 5) << 1);
 	}
 
 	if (fec->xcv_type != SEVENWIRE) {
@@ -644,8 +645,9 @@ static void mpc5xxx_fec_halt(struct eth_device *dev)
 		/*
 		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
 		 * and do not drop the Preamble.
+		 * No MII for 7-wire mode
 		 */
-		fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+		fec->eth->mii_speed = (((gd->arch.ipb_clk >> 20) / 5) << 1);
 	}
 
 #if (DEBUG & 0x3)
@@ -909,8 +911,9 @@ int mpc5xxx_fec_initialize(bd_t * bis)
 		/*
 		 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
 		 * and do not drop the Preamble.
+		 * No MII for 7-wire mode
 		 */
-		fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+		fec->eth->mii_speed = (((gd->arch.ipb_clk >> 20) / 5) << 1);
 	}
 
 	dev->priv = (void *)fec;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 24/57] ppc: Move mpc512x clocks to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (22 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 23/57] ppc: Move mpc5xxx clocks " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 25/57] ppc: Move mpc8220 " Simon Glass
                   ` (33 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move ips_clk and csb_clk into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc512x/cpu.c         |    2 +-
 arch/powerpc/cpu/mpc512x/i2c.c         |    2 +-
 arch/powerpc/cpu/mpc512x/ide.c         |    2 +-
 arch/powerpc/cpu/mpc512x/serial.c      |    2 +-
 arch/powerpc/cpu/mpc512x/speed.c       |   15 +++++++++------
 arch/powerpc/include/asm/global_data.h |    8 ++++----
 arch/powerpc/lib/board.c               |    2 +-
 drivers/net/mpc512x_fec.c              |    2 +-
 8 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/cpu.c b/arch/powerpc/cpu/mpc512x/cpu.c
index a1a3bd4..641120f 100644
--- a/arch/powerpc/cpu/mpc512x/cpu.c
+++ b/arch/powerpc/cpu/mpc512x/cpu.c
@@ -68,7 +68,7 @@ int checkcpu (void)
 	}
 	printf ("at %s MHz, CSB at %s MHz (RSR=0x%04lx)\n",
 		strmhz(buf1, clock),
-		strmhz(buf2, gd->csb_clk),
+		strmhz(buf2, gd->arch.csb_clk),
 		gd->reset_status & 0xffff);
 	return 0;
 }
diff --git a/arch/powerpc/cpu/mpc512x/i2c.c b/arch/powerpc/cpu/mpc512x/i2c.c
index 0ea1280..59040f8 100644
--- a/arch/powerpc/cpu/mpc512x/i2c.c
+++ b/arch/powerpc/cpu/mpc512x/i2c.c
@@ -250,7 +250,7 @@ static int mpc_get_fdr (int speed)
 			{126, 128}
 		};
 
-		ips = gd->ips_clk;
+		ips = gd->arch.ips_clk;
 		for (i = 7; i >= 0; i--) {
 			for (j = 7; j >= 0; j--) {
 				scl = 2 * (scltap[j].scl2tap +
diff --git a/arch/powerpc/cpu/mpc512x/ide.c b/arch/powerpc/cpu/mpc512x/ide.c
index dd6b2f4..7a49673 100644
--- a/arch/powerpc/cpu/mpc512x/ide.c
+++ b/arch/powerpc/cpu/mpc512x/ide.c
@@ -100,7 +100,7 @@ int ide_preinit (void)
 	ide_set_reset(0);
 
 	/* Init timings : we use PIO mode 0 timings */
-	t = 1000000000 / gd->ips_clk;	/* period in ns */
+	t = 1000000000 / gd->arch.ips_clk;	/* period in ns */
 	cfg.bytes.field1 = 3;
 	cfg.bytes.field2 = 3;
 	cfg.bytes.field3 = (pio_specs.t1 + t) / t;
diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index 58587fd..3afbe81 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -140,7 +140,7 @@ void serial_setbrg_dev(unsigned int idx)
 	}
 
 	/* calculate divisor for setting PSC CTUR and CTLR registers */
-	baseclk = (gd->ips_clk + 8) / 16;
+	baseclk = (gd->arch.ips_clk + 8) / 16;
 	div = (baseclk + (baudrate / 2)) / baudrate;
 
 	out_8(&psc->ctur, (div >> 8) & 0xff);
diff --git a/arch/powerpc/cpu/mpc512x/speed.c b/arch/powerpc/cpu/mpc512x/speed.c
index 9d749f2..9a8f315 100644
--- a/arch/powerpc/cpu/mpc512x/speed.c
+++ b/arch/powerpc/cpu/mpc512x/speed.c
@@ -113,9 +113,9 @@ int get_clocks (void)
 		pci_clk = 333333;
 	}
 
-	gd->ips_clk = ips_clk;
+	gd->arch.ips_clk = ips_clk;
 	gd->pci_clk = pci_clk;
-	gd->csb_clk = csb_clk;
+	gd->arch.csb_clk = csb_clk;
 	gd->cpu_clk = core_clk;
 	gd->bus_clk = csb_clk;
 	return 0;
@@ -128,7 +128,7 @@ int get_clocks (void)
  *********************************************/
 ulong get_bus_freq (ulong dummy)
 {
-	return gd->csb_clk;
+	return gd->arch.csb_clk;
 }
 
 int do_clocks (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
@@ -137,10 +137,13 @@ int do_clocks (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
 	printf("Clock configuration:\n");
 	printf("  CPU:                 %-4s MHz\n", strmhz(buf, gd->cpu_clk));
-	printf("  Coherent System Bus: %-4s MHz\n", strmhz(buf, gd->csb_clk));
-	printf("  IPS Bus:             %-4s MHz\n", strmhz(buf, gd->ips_clk));
+	printf("  Coherent System Bus: %-4s MHz\n",
+	       strmhz(buf, gd->arch.csb_clk));
+	printf("  IPS Bus:             %-4s MHz\n",
+	       strmhz(buf, gd->arch.ips_clk));
 	printf("  PCI:                 %-4s MHz\n", strmhz(buf, gd->pci_clk));
-	printf("  DDR:                 %-4s MHz\n", strmhz(buf, 2*gd->csb_clk));
+	printf("  DDR:                 %-4s MHz\n",
+	       strmhz(buf, 2 * gd->arch.csb_clk));
 	return 0;
 }
 
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 423e792..fa5c504 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -97,6 +97,10 @@ struct arch_global_data {
 #if defined(CONFIG_MPC5xxx)
 	unsigned long ipb_clk;
 #endif
+#if defined(CONFIG_MPC512X)
+	u32 ips_clk;
+	u32 csb_clk;
+#endif /* CONFIG_MPC512X */
 };
 
 /*
@@ -119,10 +123,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
-#if defined(CONFIG_MPC512X)
-	u32 ips_clk;
-	u32 csb_clk;
-#endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC8220)
 	unsigned long   bExtUart;
 	unsigned long   inp_clk;
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 07b16d5..76b6f7f 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -586,7 +586,7 @@ void board_init_f(ulong bootflag)
 	bd->bi_vco = gd->arch.vco_out;
 #endif /* CONFIG_CPM2 */
 #if defined(CONFIG_MPC512X)
-	bd->bi_ipsfreq = gd->ips_clk;
+	bd->bi_ipsfreq = gd->arch.ips_clk;
 #endif /* CONFIG_MPC512X */
 #if defined(CONFIG_MPC5xxx)
 	bd->bi_ipbfreq = gd->arch.ipb_clk;
diff --git a/drivers/net/mpc512x_fec.c b/drivers/net/mpc512x_fec.c
index ad57d56..427e0b8 100644
--- a/drivers/net/mpc512x_fec.c
+++ b/drivers/net/mpc512x_fec.c
@@ -304,7 +304,7 @@ int mpc512x_fec_init_phy (struct eth_device *dev, bd_t * bis)
 		 * and do not drop the Preamble.
 		 */
 		out_be32(&fec->eth->mii_speed,
-			 (((gd->ips_clk / 1000000) / 5) + 1) << 1);
+			 (((gd->arch.ips_clk / 1000000) / 5) + 1) << 1);
 
 		/*
 		 * Reset PHY, then delay 300ns
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 25/57] ppc: Move mpc8220 clocks to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (23 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 24/57] ppc: Move mpc512x " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 26/57] ppc: Move reset_status " Simon Glass
                   ` (32 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move these fields into arch_global_data and tidy up. The bExtUart field
does not appear to be used, so punt it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc8220/speed.c       |   12 +++++++-----
 arch/powerpc/include/asm/global_data.h |   13 ++++++-------
 arch/powerpc/lib/board.c               |   14 +++++++-------
 3 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8220/speed.c b/arch/powerpc/cpu/mpc8220/speed.c
index 62ac845..bb72e5c 100644
--- a/arch/powerpc/cpu/mpc8220/speed.c
+++ b/arch/powerpc/cpu/mpc8220/speed.c
@@ -71,7 +71,7 @@ int get_clocks (void)
 #error clock measuring not implemented yet - define CONFIG_SYS_MPC8220_CLKIN
 #endif
 
-	gd->inp_clk = CONFIG_SYS_MPC8220_CLKIN;
+	gd->arch.inp_clk = CONFIG_SYS_MPC8220_CLKIN;
 
 	/* Read XLB to PCI(INP) clock multiplier */
 	pci2bus = (*((volatile u32 *)PCI_REG_PCIGSCR) &
@@ -85,7 +85,7 @@ int get_clocks (void)
 
 	/* FlexBus is temporary set as the same as input clock */
 	/* will do dynamic in the future */
-	gd->flb_clk = CONFIG_SYS_MPC8220_CLKIN;
+	gd->arch.flb_clk = CONFIG_SYS_MPC8220_CLKIN;
 
 	/* CPU Clock - Read HID1 */
 	asm volatile ("mfspr %0, 1009":"=r" (hid1):);
@@ -97,12 +97,14 @@ int get_clocks (void)
 	for (i = 0; i < size; i++)
 		if (hid1 == bus2core[i].hid1) {
 			gd->cpu_clk = (bus2core[i].multi * gd->bus_clk) >> 1;
-			gd->vco_clk = CONFIG_SYS_MPC8220_SYSPLL_VCO_MULTIPLIER * (gd->pci_clk * bus2core[i].vco_div)/2;
+			gd->arch.vco_clk =
+				CONFIG_SYS_MPC8220_SYSPLL_VCO_MULTIPLIER *
+				(gd->pci_clk * bus2core[i].vco_div) / 2;
 			break;
 		}
 
 	/* hardcoded 81MHz for now */
-	gd->pev_clk = 81000000;
+	gd->arch.pev_clk = 81000000;
 
 	return (0);
 }
@@ -115,7 +117,7 @@ int prt_mpc8220_clks (void)
 		strmhz(buf1, gd->bus_clk),
 		strmhz(buf2, gd->cpu_clk),
 		strmhz(buf3, gd->pci_clk),
-		strmhz(buf4, gd->vco_clk)
+		strmhz(buf4, gd->arch.vco_clk)
 	);
 	return (0);
 }
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index fa5c504..656117b 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -101,6 +101,12 @@ struct arch_global_data {
 	u32 ips_clk;
 	u32 csb_clk;
 #endif /* CONFIG_MPC512X */
+#if defined(CONFIG_MPC8220)
+	unsigned long inp_clk;
+	unsigned long vco_clk;
+	unsigned long pev_clk;
+	unsigned long flb_clk;
+#endif
 };
 
 /*
@@ -123,13 +129,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
-#if defined(CONFIG_MPC8220)
-	unsigned long   bExtUart;
-	unsigned long   inp_clk;
-	unsigned long   vco_clk;
-	unsigned long   pev_clk;
-	unsigned long   flb_clk;
-#endif
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reset_status;	/* reset status register at boot	*/
 #if defined(CONFIG_MPC83xx)
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 76b6f7f..cac7d0e 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -556,11 +556,11 @@ void board_init_f(ulong bootflag)
 #endif
 #if defined(CONFIG_MPC8220)
 	bd->bi_mbar_base = CONFIG_SYS_MBAR;	/* base of internal registers */
-	bd->bi_inpfreq = gd->inp_clk;
+	bd->bi_inpfreq = gd->arch.inp_clk;
 	bd->bi_pcifreq = gd->pci_clk;
-	bd->bi_vcofreq = gd->vco_clk;
-	bd->bi_pevfreq = gd->pev_clk;
-	bd->bi_flbfreq = gd->flb_clk;
+	bd->bi_vcofreq = gd->arch.vco_clk;
+	bd->bi_pevfreq = gd->arch.pev_clk;
+	bd->bi_flbfreq = gd->arch.flb_clk;
 
 	/* store bootparam to sram (backward compatible), here? */
 	{
@@ -568,10 +568,10 @@ void board_init_f(ulong bootflag)
 
 		*sram++ = gd->ram_size;
 		*sram++ = gd->bus_clk;
-		*sram++ = gd->inp_clk;
+		*sram++ = gd->arch.inp_clk;
 		*sram++ = gd->cpu_clk;
-		*sram++ = gd->vco_clk;
-		*sram++ = gd->flb_clk;
+		*sram++ = gd->arch.vco_clk;
+		*sram++ = gd->arch.flb_clk;
 		*sram++ = 0xb8c3ba11;	/* boot signature */
 	}
 #endif
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 26/57] ppc: Move reset_status to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (24 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 25/57] ppc: Move mpc8220 " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 27/57] ppc: Move arbiter fields " Simon Glass
                   ` (31 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc512x/cpu.c         |    2 +-
 arch/powerpc/cpu/mpc512x/cpu_init.c    |    2 +-
 arch/powerpc/cpu/mpc8260/cpu_init.c    |    4 ++--
 arch/powerpc/cpu/mpc83xx/cpu_init.c    |    4 ++--
 arch/powerpc/include/asm/global_data.h |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/cpu.c b/arch/powerpc/cpu/mpc512x/cpu.c
index 641120f..bb03c6d 100644
--- a/arch/powerpc/cpu/mpc512x/cpu.c
+++ b/arch/powerpc/cpu/mpc512x/cpu.c
@@ -69,7 +69,7 @@ int checkcpu (void)
 	printf ("at %s MHz, CSB at %s MHz (RSR=0x%04lx)\n",
 		strmhz(buf1, clock),
 		strmhz(buf2, gd->arch.csb_clk),
-		gd->reset_status & 0xffff);
+		gd->arch.reset_status & 0xffff);
 	return 0;
 }
 
diff --git a/arch/powerpc/cpu/mpc512x/cpu_init.c b/arch/powerpc/cpu/mpc512x/cpu_init.c
index fe6beaf..32ade1b 100644
--- a/arch/powerpc/cpu/mpc512x/cpu_init.c
+++ b/arch/powerpc/cpu/mpc512x/cpu_init.c
@@ -62,7 +62,7 @@ void cpu_init_f (volatile immap_t * im)
 #endif
 
 	/* RSR - Reset Status Register - clear all status */
-	gd->reset_status = im->reset.rsr;
+	gd->arch.reset_status = im->reset.rsr;
 	out_be32(&im->reset.rsr, ~RSR_RES);
 
 	/*
diff --git a/arch/powerpc/cpu/mpc8260/cpu_init.c b/arch/powerpc/cpu/mpc8260/cpu_init.c
index acd48a9..3964e60 100644
--- a/arch/powerpc/cpu/mpc8260/cpu_init.c
+++ b/arch/powerpc/cpu/mpc8260/cpu_init.c
@@ -120,7 +120,7 @@ void cpu_init_f (volatile immap_t * immr)
 	memset ((void *) gd, 0, sizeof (gd_t));
 
 	/* RSR - Reset Status Register - clear all status (5-4) */
-	gd->reset_status = immr->im_clkrst.car_rsr;
+	gd->arch.reset_status = immr->im_clkrst.car_rsr;
 	immr->im_clkrst.car_rsr = RSR_ALLBITS;
 
 	/* RMR - Reset Mode Register - contains checkstop reset enable (5-5) */
@@ -274,7 +274,7 @@ int prt_8260_rsr (void)
 		RSR_EHRS, "External Hard"}
 	};
 	static int n = sizeof bits / sizeof bits[0];
-	ulong rsr = gd->reset_status;
+	ulong rsr = gd->arch.reset_status;
 	int i;
 	char *sep;
 
diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c b/arch/powerpc/cpu/mpc83xx/cpu_init.c
index 20d0600..9325110 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c
@@ -232,7 +232,7 @@ void cpu_init_f (volatile immap_t * im)
 	clrsetbits_be32(&im->clk.sccr, sccr_mask, sccr_val);
 
 	/* RSR - Reset Status Register - clear all status (4.6.1.3) */
-	gd->reset_status = __raw_readl(&im->reset.rsr);
+	gd->arch.reset_status = __raw_readl(&im->reset.rsr);
 	__raw_writel(~(RSR_RES), &im->reset.rsr);
 
 	/* AER - Arbiter Event Register - store status */
@@ -499,7 +499,7 @@ int prt_83xx_rsr(void)
 		RSR_HRS,  "External/Internal Hard"}
 	};
 	static int n = sizeof bits / sizeof bits[0];
-	ulong rsr = gd->reset_status;
+	ulong rsr = gd->arch.reset_status;
 	int i;
 	char *sep;
 
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 656117b..136b918 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -107,6 +107,7 @@ struct arch_global_data {
 	unsigned long pev_clk;
 	unsigned long flb_clk;
 #endif
+	unsigned long reset_status;	/* reset status register at boot */
 };
 
 /*
@@ -130,7 +131,6 @@ typedef	struct	global_data {
 	u32 sdhc_clk;
 #endif
 	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	reset_status;	/* reset status register at boot	*/
 #if defined(CONFIG_MPC83xx)
 	unsigned long	arbiter_event_attributes;
 	unsigned long	arbiter_event_address;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 27/57] ppc: Move arbiter fields to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (25 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 26/57] ppc: Move reset_status " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 28/57] ppc: Move dp_alloc_base, dp_alloc_top " Simon Glass
                   ` (30 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move arbiter_event_attributes and arbiter_event_address into
arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc83xx/cpu_init.c    |   28 +++++++++++++++-------------
 arch/powerpc/include/asm/global_data.h |    8 ++++----
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c b/arch/powerpc/cpu/mpc83xx/cpu_init.c
index 9325110..5153351 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c
@@ -236,8 +236,8 @@ void cpu_init_f (volatile immap_t * im)
 	__raw_writel(~(RSR_RES), &im->reset.rsr);
 
 	/* AER - Arbiter Event Register - store status */
-	gd->arbiter_event_attributes = __raw_readl(&im->arbiter.aeatr);
-	gd->arbiter_event_address = __raw_readl(&im->arbiter.aeadr);
+	gd->arch.arbiter_event_attributes = __raw_readl(&im->arbiter.aeatr);
+	gd->arch.arbiter_event_address = __raw_readl(&im->arbiter.aeadr);
 
 	/*
 	 * RMR - Reset Mode Register
@@ -440,42 +440,44 @@ static int print_83xx_arb_event(int force)
 		"reserved"
 	};
 
-	int etype = (gd->arbiter_event_attributes & AEATR_EVENT)
+	int etype = (gd->arch.arbiter_event_attributes & AEATR_EVENT)
 	            >> AEATR_EVENT_SHIFT;
-	int mstr_id = (gd->arbiter_event_attributes & AEATR_MSTR_ID)
+	int mstr_id = (gd->arch.arbiter_event_attributes & AEATR_MSTR_ID)
 	              >> AEATR_MSTR_ID_SHIFT;
-	int tbst = (gd->arbiter_event_attributes & AEATR_TBST)
+	int tbst = (gd->arch.arbiter_event_attributes & AEATR_TBST)
 	           >> AEATR_TBST_SHIFT;
-	int tsize = (gd->arbiter_event_attributes & AEATR_TSIZE)
+	int tsize = (gd->arch.arbiter_event_attributes & AEATR_TSIZE)
 	            >> AEATR_TSIZE_SHIFT;
-	int ttype = (gd->arbiter_event_attributes & AEATR_TTYPE)
+	int ttype = (gd->arch.arbiter_event_attributes & AEATR_TTYPE)
 	            >> AEATR_TTYPE_SHIFT;
 
-	if (!force && !gd->arbiter_event_address)
+	if (!force && !gd->arch.arbiter_event_address)
 		return 0;
 
 	puts("Arbiter Event Status:\n");
-	printf("       Event Address: 0x%08lX\n", gd->arbiter_event_address);
+	printf("       Event Address: 0x%08lX\n",
+	       gd->arch.arbiter_event_address);
 	printf("       Event Type:    0x%1x  = %s\n", etype, event[etype]);
 	printf("       Master ID:     0x%02x = %s\n", mstr_id, master[mstr_id]);
 	printf("       Transfer Size: 0x%1x  = %d bytes\n", (tbst<<3) | tsize,
 				tbst ? (tsize ? tsize : 8) : 16 + 8 * tsize);
 	printf("       Transfer Type: 0x%02x = %s\n", ttype, transfer[ttype]);
 
-	return gd->arbiter_event_address;
+	return gd->arch.arbiter_event_address;
 }
 
 #elif defined(CONFIG_DISPLAY_AER_BRIEF)
 
 static int print_83xx_arb_event(int force)
 {
-	if (!force && !gd->arbiter_event_address)
+	if (!force && !gd->arch.arbiter_event_address)
 		return 0;
 
 	printf("Arbiter Event Status: AEATR=0x%08lX, AEADR=0x%08lX\n",
-		gd->arbiter_event_attributes, gd->arbiter_event_address);
+		gd->arch.arbiter_event_attributes,
+		gd->arch.arbiter_event_address);
 
-	return gd->arbiter_event_address;
+	return gd->arch.arbiter_event_address;
 }
 #endif /* CONFIG_DISPLAY_AER_xxxx */
 
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 136b918..b7534cd 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -108,6 +108,10 @@ struct arch_global_data {
 	unsigned long flb_clk;
 #endif
 	unsigned long reset_status;	/* reset status register at boot */
+#if defined(CONFIG_MPC83xx)
+	unsigned long arbiter_event_attributes;
+	unsigned long arbiter_event_address;
+#endif
 };
 
 /*
@@ -131,10 +135,6 @@ typedef	struct	global_data {
 	u32 sdhc_clk;
 #endif
 	phys_size_t	ram_size;	/* RAM size */
-#if defined(CONFIG_MPC83xx)
-	unsigned long	arbiter_event_attributes;
-	unsigned long	arbiter_event_address;
-#endif
 	unsigned long	env_addr;	/* Address  of Environment struct	*/
 	unsigned long	env_valid;	/* Checksum of Environment valid?	*/
 	unsigned long	have_console;	/* serial_init() was called		*/
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 28/57] ppc: Move dp_alloc_base, dp_alloc_top to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (26 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 27/57] ppc: Move arbiter fields " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 29/57] arm: Move uart_clk " Simon Glass
                   ` (29 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move these fields into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/mpc8260/commproc.c        |   19 ++++++++++---------
 arch/powerpc/cpu/mpc85xx/commproc.c        |   19 ++++++++++---------
 arch/powerpc/cpu/mpc8xx/commproc.c         |   20 ++++++++++----------
 arch/powerpc/include/asm/global_data.h     |    8 ++++----
 examples/standalone/mem_to_mem_idma2intr.c |    4 ++--
 5 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8260/commproc.c b/arch/powerpc/cpu/mpc8260/commproc.c
index e5bfed1..22cef3e 100644
--- a/arch/powerpc/cpu/mpc8260/commproc.c
+++ b/arch/powerpc/cpu/mpc8260/commproc.c
@@ -30,8 +30,8 @@ m8260_cpm_reset(void)
 
 	/* Reclaim the DP memory for our use.
 	*/
-	gd->dp_alloc_base = CPM_DATAONLY_BASE;
-	gd->dp_alloc_top = gd->dp_alloc_base + CPM_DATAONLY_SIZE;
+	gd->arch.dp_alloc_base = CPM_DATAONLY_BASE;
+	gd->arch.dp_alloc_top = gd->arch.dp_alloc_base + CPM_DATAONLY_SIZE;
 
 	/*
 	 * Reset CPM
@@ -60,21 +60,22 @@ m8260_cpm_dpalloc(uint size, uint align)
 	uint	savebase;
 
 	align_mask = align - 1;
-	savebase = gd->dp_alloc_base;
+	savebase = gd->arch.dp_alloc_base;
 
-	if ((off = (gd->dp_alloc_base & align_mask)) != 0)
-		gd->dp_alloc_base += (align - off);
+	off = gd->arch.dp_alloc_base & align_mask;
+	if (off != 0)
+		gd->arch.dp_alloc_base += (align - off);
 
 	if ((off = size & align_mask) != 0)
 		size += align - off;
 
-	if ((gd->dp_alloc_base + size) >= gd->dp_alloc_top) {
-		gd->dp_alloc_base = savebase;
+	if ((gd->arch.dp_alloc_base + size) >= gd->arch.dp_alloc_top) {
+		gd->arch.dp_alloc_base = savebase;
 		panic("m8260_cpm_dpalloc: ran out of dual port ram!");
 	}
 
-	retloc = gd->dp_alloc_base;
-	gd->dp_alloc_base += size;
+	retloc = gd->arch.dp_alloc_base;
+	gd->arch.dp_alloc_base += size;
 
 	memset((void *)&immr->im_dprambase[retloc], 0, size);
 
diff --git a/arch/powerpc/cpu/mpc85xx/commproc.c b/arch/powerpc/cpu/mpc85xx/commproc.c
index 7f10476..37e7062 100644
--- a/arch/powerpc/cpu/mpc85xx/commproc.c
+++ b/arch/powerpc/cpu/mpc85xx/commproc.c
@@ -43,8 +43,8 @@ m8560_cpm_reset(void)
 
 	/* Reclaim the DP memory for our use.
 	*/
-	gd->dp_alloc_base = CPM_DATAONLY_BASE;
-	gd->dp_alloc_top = gd->dp_alloc_base + CPM_DATAONLY_SIZE;
+	gd->arch.dp_alloc_base = CPM_DATAONLY_BASE;
+	gd->arch.dp_alloc_top = gd->arch.dp_alloc_base + CPM_DATAONLY_SIZE;
 
 	/*
 	 * Reset CPM
@@ -69,21 +69,22 @@ m8560_cpm_dpalloc(uint size, uint align)
 	uint	savebase;
 
 	align_mask = align - 1;
-	savebase = gd->dp_alloc_base;
+	savebase = gd->arch.dp_alloc_base;
 
-	if ((off = (gd->dp_alloc_base & align_mask)) != 0)
-		gd->dp_alloc_base += (align - off);
+	off = gd->arch.dp_alloc_base & align_mask;
+	if (off != 0)
+		gd->arch.dp_alloc_base += (align - off);
 
 	if ((off = size & align_mask) != 0)
 		size += align - off;
 
-	if ((gd->dp_alloc_base + size) >= gd->dp_alloc_top) {
-		gd->dp_alloc_base = savebase;
+	if ((gd->arch.dp_alloc_base + size) >= gd->arch.dp_alloc_top) {
+		gd->arch.dp_alloc_base = savebase;
 		panic("m8560_cpm_dpalloc: ran out of dual port ram!");
 	}
 
-	retloc = gd->dp_alloc_base;
-	gd->dp_alloc_base += size;
+	retloc = gd->arch.dp_alloc_base;
+	gd->arch.dp_alloc_base += size;
 
 	memset((void *)&(cpm->im_dprambase[retloc]), 0, size);
 
diff --git a/arch/powerpc/cpu/mpc8xx/commproc.c b/arch/powerpc/cpu/mpc8xx/commproc.c
index 5fe01ff..a364782 100644
--- a/arch/powerpc/cpu/mpc8xx/commproc.c
+++ b/arch/powerpc/cpu/mpc8xx/commproc.c
@@ -31,8 +31,8 @@ DECLARE_GLOBAL_DATA_PTR;
 int dpram_init (void)
 {
 	/* Reclaim the DP memory for our use. */
-	gd->dp_alloc_base = CPM_DATAONLY_BASE;
-	gd->dp_alloc_top  = CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE;
+	gd->arch.dp_alloc_base = CPM_DATAONLY_BASE;
+	gd->arch.dp_alloc_top  = CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE;
 
 	return (0);
 }
@@ -43,19 +43,19 @@ int dpram_init (void)
  */
 uint dpram_alloc (uint size)
 {
-	uint addr = gd->dp_alloc_base;
+	uint addr = gd->arch.dp_alloc_base;
 
-	if ((gd->dp_alloc_base + size) >= gd->dp_alloc_top)
+	if ((gd->arch.dp_alloc_base + size) >= gd->arch.dp_alloc_top)
 		return (CPM_DP_NOSPACE);
 
-	gd->dp_alloc_base += size;
+	gd->arch.dp_alloc_base += size;
 
 	return addr;
 }
 
 uint dpram_base (void)
 {
-	return gd->dp_alloc_base;
+	return gd->arch.dp_alloc_base;
 }
 
 /* Allocate some memory from the dual ported ram.  We may want to
@@ -66,12 +66,12 @@ uint dpram_alloc_align (uint size, uint align)
 {
 	uint addr, mask = align - 1;
 
-	addr = (gd->dp_alloc_base + mask) & ~mask;
+	addr = (gd->arch.dp_alloc_base + mask) & ~mask;
 
-	if ((addr + size) >= gd->dp_alloc_top)
+	if ((addr + size) >= gd->arch.dp_alloc_top)
 		return (CPM_DP_NOSPACE);
 
-	gd->dp_alloc_base = addr + size;
+	gd->arch.dp_alloc_base = addr + size;
 
 	return addr;
 }
@@ -80,6 +80,6 @@ uint dpram_base_align (uint align)
 {
 	uint mask = align - 1;
 
-	return (gd->dp_alloc_base + mask) & ~mask;
+	return (gd->arch.dp_alloc_base + mask) & ~mask;
 }
 #endif	/* CONFIG_SYS_ALLOC_DPRAM */
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index b7534cd..87f9268 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -112,6 +112,10 @@ struct arch_global_data {
 	unsigned long arbiter_event_attributes;
 	unsigned long arbiter_event_address;
 #endif
+#if defined(CONFIG_SYS_ALLOC_DPRAM) || defined(CONFIG_CPM2)
+	unsigned int dp_alloc_base;
+	unsigned int dp_alloc_top;
+#endif
 };
 
 /*
@@ -141,10 +145,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_PRE_CONSOLE_BUFFER
 	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
 #endif
-#if defined(CONFIG_SYS_ALLOC_DPRAM) || defined(CONFIG_CPM2)
-	unsigned int	dp_alloc_base;
-	unsigned int	dp_alloc_top;
-#endif
 #if defined(CONFIG_4xx)
 	u32  uart_clk;
 #endif /* CONFIG_4xx */
diff --git a/examples/standalone/mem_to_mem_idma2intr.c b/examples/standalone/mem_to_mem_idma2intr.c
index d0a75ea..e466c90 100644
--- a/examples/standalone/mem_to_mem_idma2intr.c
+++ b/examples/standalone/mem_to_mem_idma2intr.c
@@ -356,7 +356,7 @@ uint dpalloc (uint size, uint align)
 	/* Pointer to initial global data area */
 
 	if (dpinit_done == 0) {
-		dpbase = gd->dp_alloc_base;
+		dpbase = gd->arch.dp_alloc_base;
 		dpinit_done = 1;
 	}
 
@@ -369,7 +369,7 @@ uint dpalloc (uint size, uint align)
 	if ((off = size & align_mask) != 0)
 		size += align - off;
 
-	if ((dpbase + size) >= gd->dp_alloc_top) {
+	if ((dpbase + size) >= gd->arch.dp_alloc_top) {
 		dpbase = savebase;
 		printf ("dpalloc: ran out of dual port ram!");
 		return 0;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 29/57] arm: Move uart_clk to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (27 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 28/57] ppc: Move dp_alloc_base, dp_alloc_top " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 30/57] ppc: Move mirror_hack " Simon Glass
                   ` (28 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/cpu/ppc4xx/4xx_uart.c     |    4 ++--
 arch/powerpc/cpu/ppc4xx/fdt.c          |    4 ++--
 arch/powerpc/include/asm/global_data.h |    6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/cpu/ppc4xx/4xx_uart.c b/arch/powerpc/cpu/ppc4xx/4xx_uart.c
index 38ba60b..2ab185f 100644
--- a/arch/powerpc/cpu/ppc4xx/4xx_uart.c
+++ b/arch/powerpc/cpu/ppc4xx/4xx_uart.c
@@ -296,10 +296,10 @@ int get_serial_clock(void)
 	 * the UART divisor is available
 	 */
 #ifdef CONFIG_SYS_EXT_SERIAL_CLOCK
-	gd->uart_clk = CONFIG_SYS_EXT_SERIAL_CLOCK;
+	gd->arch.uart_clk = CONFIG_SYS_EXT_SERIAL_CLOCK;
 #else
 	get_sys_info(&sys_info);
-	gd->uart_clk = sys_info.freqUART / udiv;
+	gd->arch.uart_clk = sys_info.freqUART / udiv;
 #endif
 
 	return clk;
diff --git a/arch/powerpc/cpu/ppc4xx/fdt.c b/arch/powerpc/cpu/ppc4xx/fdt.c
index 5ddb880..37f5817 100644
--- a/arch/powerpc/cpu/ppc4xx/fdt.c
+++ b/arch/powerpc/cpu/ppc4xx/fdt.c
@@ -141,7 +141,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 
 	/*
 	 * Fixup all UART clocks for CPU internal UARTs
-	 * (only these UARTs are definitely clocked by gd->uart_clk)
+	 * (only these UARTs are definitely clocked by gd->arch.uart_clk)
 	 *
 	 * These UARTs are direct childs of /plb/opb. This code
 	 * does not touch any UARTs that are connected to the ebc.
@@ -160,7 +160,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 		    (fdt_node_check_compatible(blob, off, "ns16550") == 0))
 			fdt_setprop(blob, off,
 				    "clock-frequency",
-				    (void*)&(gd->uart_clk), 4);
+				    (void *)&gd->arch.uart_clk, 4);
 	}
 
 	/*
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 87f9268..2d7be45 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -116,6 +116,9 @@ struct arch_global_data {
 	unsigned int dp_alloc_base;
 	unsigned int dp_alloc_top;
 #endif
+#if defined(CONFIG_4xx)
+	u32 uart_clk;
+#endif /* CONFIG_4xx */
 };
 
 /*
@@ -145,9 +148,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_PRE_CONSOLE_BUFFER
 	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
 #endif
-#if defined(CONFIG_4xx)
-	u32  uart_clk;
-#endif /* CONFIG_4xx */
 #if defined(CONFIG_SYS_GT_6426x)
 	unsigned int	mirror_hack[16];
 #endif
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 30/57] ppc: Move mirror_hack to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (28 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 29/57] arm: Move uart_clk " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 31/57] ppc: Remove console_addr from global data Simon Glass
                   ` (27 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/include/asm/global_data.h |    6 +++---
 board/evb64260/mpsc.c                  |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 2d7be45..b9037c4 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -119,6 +119,9 @@ struct arch_global_data {
 #if defined(CONFIG_4xx)
 	u32 uart_clk;
 #endif /* CONFIG_4xx */
+#if defined(CONFIG_SYS_GT_6426x)
+	unsigned int mirror_hack[16];
+#endif
 };
 
 /*
@@ -148,9 +151,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_PRE_CONSOLE_BUFFER
 	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
 #endif
-#if defined(CONFIG_SYS_GT_6426x)
-	unsigned int	mirror_hack[16];
-#endif
 #if defined(CONFIG_A3000)	|| \
     defined(CONFIG_HIDDEN_DRAGON)  || \
     defined(CONFIG_MUSENKI)	||  \
diff --git a/board/evb64260/mpsc.c b/board/evb64260/mpsc.c
index f3dc20b..9c211ac 100644
--- a/board/evb64260/mpsc.c
+++ b/board/evb64260/mpsc.c
@@ -88,7 +88,7 @@ static void galsdma_enable_rx(void);
 
 
 /* GT64240A errata: cant read MPSC/BRG registers... so make mirrors in ram for read/modify write */
-#define MIRROR_HACK ((struct _tag_mirror_hack *)&(gd->mirror_hack[0]))
+#define MIRROR_HACK ((struct _tag_mirror_hack *)&(gd->arch.mirror_hack[0]))
 
 #define GT_REG_WRITE_MIRROR_G(a,d) {MIRROR_HACK->a ## _M = d; GT_REG_WRITE(a,d);}
 #define GTREGREAD_MIRROR_G(a) (MIRROR_HACK->a ## _M)
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 31/57] ppc: Remove console_addr from global data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (29 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 30/57] ppc: Move mirror_hack " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 32/57] ppc: Move fpga_state to arch_global_data Simon Glass
                   ` (26 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

This does not appear to be used, so punt it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/include/asm/global_data.h |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index b9037c4..6f88b76 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -151,12 +151,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_PRE_CONSOLE_BUFFER
 	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
 #endif
-#if defined(CONFIG_A3000)	|| \
-    defined(CONFIG_HIDDEN_DRAGON)  || \
-    defined(CONFIG_MUSENKI)	||  \
-    defined(CONFIG_SANDPOINT)
-	void *		console_addr;
-#endif
 	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
 	unsigned long	fb_base;	/* Base address of framebuffer memory	*/
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 32/57] ppc: Move fpga_state to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (30 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 31/57] ppc: Remove console_addr from global data Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 33/57] ppc: Move wdt_last " Simon Glass
                   ` (25 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/include/asm/global_data.h |    6 +++---
 board/gdsys/405ep/405ep.c              |   15 ++++++++-------
 board/gdsys/405ex/405ex.c              |   13 +++++++------
 board/gdsys/405ex/io64.c               |    2 +-
 4 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 6f88b76..52aece0 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -122,6 +122,9 @@ struct arch_global_data {
 #if defined(CONFIG_SYS_GT_6426x)
 	unsigned int mirror_hack[16];
 #endif
+#ifdef CONFIG_SYS_FPGA_COUNT
+	unsigned fpga_state[CONFIG_SYS_FPGA_COUNT];
+#endif
 };
 
 /*
@@ -170,9 +173,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_LWMON) || defined(CONFIG_LWMON5)
 	unsigned long kbd_status;
 #endif
-#ifdef CONFIG_SYS_FPGA_COUNT
-	unsigned fpga_state[CONFIG_SYS_FPGA_COUNT];
-#endif
 #if defined(CONFIG_WD_MAX_RATE)
 	unsigned long long wdt_last;	/* trace watch-dog triggering rate */
 #endif
diff --git a/board/gdsys/405ep/405ep.c b/board/gdsys/405ep/405ep.c
index bc9b7d0..6221171 100644
--- a/board/gdsys/405ep/405ep.c
+++ b/board/gdsys/405ep/405ep.c
@@ -38,14 +38,14 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int get_fpga_state(unsigned dev)
 {
-	return gd->fpga_state[dev];
+	return gd->arch.fpga_state[dev];
 }
 
 void print_fpga_state(unsigned dev)
 {
-	if (gd->fpga_state[dev] & FPGA_STATE_DONE_FAILED)
+	if (gd->arch.fpga_state[dev] & FPGA_STATE_DONE_FAILED)
 		puts("       Waiting for FPGA-DONE timed out.\n");
-	if (gd->fpga_state[dev] & FPGA_STATE_REFLECTION_FAILED)
+	if (gd->arch.fpga_state[dev] & FPGA_STATE_REFLECTION_FAILED)
 		puts("       FPGA reflection test failed.\n");
 }
 
@@ -54,7 +54,7 @@ int board_early_init_f(void)
 	unsigned k;
 
 	for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k)
-		gd->fpga_state[k] = 0;
+		gd->arch.fpga_state[k] = 0;
 
 	mtdcr(UIC0SR, 0xFFFFFFFF);	/* clear all ints */
 	mtdcr(UIC0ER, 0x00000000);	/* disable all ints */
@@ -78,7 +78,7 @@ int board_early_init_r(void)
 	unsigned ctr;
 
 	for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k)
-		gd->fpga_state[k] = 0;
+		gd->arch.fpga_state[k] = 0;
 
 	/*
 	 * reset FPGA
@@ -94,7 +94,8 @@ int board_early_init_r(void)
 		while (!gd405ep_get_fpga_done(k)) {
 			udelay(100000);
 			if (ctr++ > 5) {
-				gd->fpga_state[k] |= FPGA_STATE_DONE_FAILED;
+				gd->arch.fpga_state[k] |=
+					FPGA_STATE_DONE_FAILED;
 				break;
 			}
 		}
@@ -126,7 +127,7 @@ int board_early_init_r(void)
 
 			udelay(100000);
 			if (ctr++ > 5) {
-				gd->fpga_state[k] |=
+				gd->arch.fpga_state[k] |=
 					FPGA_STATE_REFLECTION_FAILED;
 				break;
 			}
diff --git a/board/gdsys/405ex/405ex.c b/board/gdsys/405ex/405ex.c
index 5766c0f..32e24c0 100644
--- a/board/gdsys/405ex/405ex.c
+++ b/board/gdsys/405ex/405ex.c
@@ -15,14 +15,14 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int get_fpga_state(unsigned dev)
 {
-	return gd->fpga_state[dev];
+	return gd->arch.fpga_state[dev];
 }
 
 void print_fpga_state(unsigned dev)
 {
-	if (gd->fpga_state[dev] & FPGA_STATE_DONE_FAILED)
+	if (gd->arch.fpga_state[dev] & FPGA_STATE_DONE_FAILED)
 		puts("       Waiting for FPGA-DONE timed out.\n");
-	if (gd->fpga_state[dev] & FPGA_STATE_REFLECTION_FAILED)
+	if (gd->arch.fpga_state[dev] & FPGA_STATE_REFLECTION_FAILED)
 		puts("       FPGA reflection test failed.\n");
 }
 
@@ -192,7 +192,7 @@ int board_early_init_r(void)
 	unsigned ctr;
 
 	for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k)
-		gd->fpga_state[k] = 0;
+		gd->arch.fpga_state[k] = 0;
 
 	/*
 	 * reset FPGA
@@ -208,7 +208,8 @@ int board_early_init_r(void)
 		while (!gd405ex_get_fpga_done(k)) {
 			udelay(100000);
 			if (ctr++ > 5) {
-				gd->fpga_state[k] |= FPGA_STATE_DONE_FAILED;
+				gd->arch.fpga_state[k] |=
+					FPGA_STATE_DONE_FAILED;
 				break;
 			}
 		}
@@ -240,7 +241,7 @@ int board_early_init_r(void)
 
 			udelay(100000);
 			if (ctr++ > 5) {
-				gd->fpga_state[k] |=
+				gd->arch.fpga_state[k] |=
 					FPGA_STATE_REFLECTION_FAILED;
 				break;
 			}
diff --git a/board/gdsys/405ex/io64.c b/board/gdsys/405ex/io64.c
index 41fdef7..7d2899d 100644
--- a/board/gdsys/405ex/io64.c
+++ b/board/gdsys/405ex/io64.c
@@ -359,7 +359,7 @@ void gd405ex_init(void)
 
 	if (i2c_probe(0x22)) { /* i2c_probe returns 0 on success */
 		for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k)
-			gd->fpga_state[k] |= FPGA_STATE_PLATFORM;
+			gd->arch.fpga_state[k] |= FPGA_STATE_PLATFORM;
 	} else {
 		pca9698_direction_output(0x22, 39, 1);
 	}
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 33/57] ppc: Move wdt_last to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (31 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 32/57] ppc: Move fpga_state to arch_global_data Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 34/57] ppc: Move kbd_status " Simon Glass
                   ` (24 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/include/asm/global_data.h |    6 +++---
 board/lwmon5/lwmon5.c                  |    8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 52aece0..b138e64 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -125,6 +125,9 @@ struct arch_global_data {
 #ifdef CONFIG_SYS_FPGA_COUNT
 	unsigned fpga_state[CONFIG_SYS_FPGA_COUNT];
 #endif
+#if defined(CONFIG_WD_MAX_RATE)
+	unsigned long long wdt_last;	/* trace watch-dog triggering rate */
+#endif
 };
 
 /*
@@ -173,9 +176,6 @@ typedef	struct	global_data {
 #if defined(CONFIG_LWMON) || defined(CONFIG_LWMON5)
 	unsigned long kbd_status;
 #endif
-#if defined(CONFIG_WD_MAX_RATE)
-	unsigned long long wdt_last;	/* trace watch-dog triggering rate */
-#endif
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
 	struct arch_global_data arch;	/* architecture-specific data */
diff --git a/board/lwmon5/lwmon5.c b/board/lwmon5/lwmon5.c
index ecd9536..29e24fb 100644
--- a/board/lwmon5/lwmon5.c
+++ b/board/lwmon5/lwmon5.c
@@ -357,16 +357,16 @@ void hw_watchdog_reset(void)
 	 * Don't allow watch-dog triggering more frequently than
 	 * the predefined value CONFIG_WD_MAX_RATE [ticks].
 	 */
-	if (ct >= gd->wdt_last) {
-		if ((ct - gd->wdt_last) < CONFIG_WD_MAX_RATE)
+	if (ct >= gd->arch.wdt_last) {
+		if ((ct - gd->arch.wdt_last) < CONFIG_WD_MAX_RATE)
 			return;
 	} else {
 		/* Time base counter had been reset */
-		if (((unsigned long long)(-1) - gd->wdt_last + ct) <
+		if (((unsigned long long)(-1) - gd->arch.wdt_last + ct) <
 		    CONFIG_WD_MAX_RATE)
 			return;
 	}
-	gd->wdt_last = get_ticks();
+	gd->arch.wdt_last = get_ticks();
 #endif
 
 	/*
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 34/57] ppc: Move kbd_status to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (32 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 33/57] ppc: Move wdt_last " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 35/57] ppc: arm: Move sdhc_clk into arch_global_data Simon Glass
                   ` (23 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/include/asm/global_data.h |    6 +++---
 board/lwmon/lwmon.c                    |   10 +++++-----
 board/lwmon5/kbd.c                     |   10 +++++-----
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index b138e64..ea67537 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -128,6 +128,9 @@ struct arch_global_data {
 #if defined(CONFIG_WD_MAX_RATE)
 	unsigned long long wdt_last;	/* trace watch-dog triggering rate */
 #endif
+#if defined(CONFIG_LWMON) || defined(CONFIG_LWMON5)
+	unsigned long kbd_status;
+#endif
 };
 
 /*
@@ -173,9 +176,6 @@ typedef	struct	global_data {
 	unsigned long do_mdm_init;
 	unsigned long be_quiet;
 #endif
-#if defined(CONFIG_LWMON) || defined(CONFIG_LWMON5)
-	unsigned long kbd_status;
-#endif
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
 	struct arch_global_data arch;	/* architecture-specific data */
diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c
index b5e524b..34c6675 100644
--- a/board/lwmon/lwmon.c
+++ b/board/lwmon/lwmon.c
@@ -482,7 +482,7 @@ static void kbd_init (void)
 
 	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 
-	gd->kbd_status = 0;
+	gd->arch.kbd_status = 0;
 
 	/* Forced by PIC. Delays <= 175us loose */
 	udelay(1000);
@@ -496,7 +496,7 @@ static void kbd_init (void)
 	/* clear "irrelevant" bits. Recommended by Martin Rajek, LWN */
 	errcd &= ~(KEYBD_STATUS_H_RESET|KEYBD_STATUS_BROWNOUT);
 	if (errcd) {
-		gd->kbd_status |= errcd << 8;
+		gd->arch.kbd_status |= errcd << 8;
 	}
 	/* Reset error code and verify */
 	val = KEYBD_CMD_RESET_ERRORS;
@@ -509,7 +509,7 @@ static void kbd_init (void)
 
 	val &= KEYBD_STATUS_MASK;	/* clear unused bits */
 	if (val) {			/* permanent error, report it */
-		gd->kbd_status |= val;
+		gd->arch.kbd_status |= val;
 		return;
 	}
 
@@ -568,8 +568,8 @@ int misc_init_r (void)
 {
 	uchar kbd_data[KEYBD_DATALEN];
 	char keybd_env[2 * KEYBD_DATALEN + 1];
-	uchar kbd_init_status = gd->kbd_status >> 8;
-	uchar kbd_status = gd->kbd_status;
+	uchar kbd_init_status = gd->arch.kbd_status >> 8;
+	uchar kbd_status = gd->arch.kbd_status;
 	uchar val;
 	char *str;
 	int i;
diff --git a/board/lwmon5/kbd.c b/board/lwmon5/kbd.c
index 5231c7a..b66f681 100644
--- a/board/lwmon5/kbd.c
+++ b/board/lwmon5/kbd.c
@@ -113,7 +113,7 @@ static void kbd_init (void)
 
 	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 
-	gd->kbd_status = 0;
+	gd->arch.kbd_status = 0;
 
 	/* Forced by PIC. Delays <= 175us loose */
 	udelay(1000);
@@ -127,7 +127,7 @@ static void kbd_init (void)
 	/* clear "irrelevant" bits. Recommended by Martin Rajek, LWN */
 	errcd &= ~(KEYBD_STATUS_H_RESET|KEYBD_STATUS_BROWNOUT);
 	if (errcd) {
-		gd->kbd_status |= errcd << 8;
+		gd->arch.kbd_status |= errcd << 8;
 	}
 	/* Reset error code and verify */
 	val = KEYBD_CMD_RESET_ERRORS;
@@ -140,7 +140,7 @@ static void kbd_init (void)
 
 	val &= KEYBD_STATUS_MASK;	/* clear unused bits */
 	if (val) {			/* permanent error, report it */
-		gd->kbd_status |= val;
+		gd->arch.kbd_status |= val;
 		return;
 	}
 
@@ -216,8 +216,8 @@ int misc_init_r_kbd (void)
 {
 	uchar kbd_data[KEYBD_DATALEN];
 	char keybd_env[2 * KEYBD_DATALEN + 1];
-	uchar kbd_init_status = gd->kbd_status >> 8;
-	uchar kbd_status = gd->kbd_status;
+	uchar kbd_init_status = gd->arch.kbd_status >> 8;
+	uchar kbd_status = gd->arch.kbd_status;
 	uchar val;
 	ushort data, inv_data;
 	char *str;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 35/57] ppc: arm: Move sdhc_clk into arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (33 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 34/57] ppc: Move kbd_status " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 36/57] sparc: Drop kbd_status and reset_status from global_data Simon Glass
                   ` (22 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

This is used by both powerpc and arm, but I think it still qualifies as
architecture-specific.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/arm1136/mx35/generic.c    |    6 +++---
 arch/arm/cpu/arm926ejs/mx25/generic.c  |    4 ++--
 arch/arm/imx-common/speed.c            |   16 ++++++++--------
 arch/arm/include/asm/global_data.h     |    6 +++---
 arch/powerpc/cpu/mpc83xx/speed.c       |    5 +++--
 arch/powerpc/cpu/mpc85xx/speed.c       |    4 ++--
 arch/powerpc/include/asm/global_data.h |    6 +++---
 drivers/mmc/fsl_esdhc.c                |    6 +++---
 8 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx35/generic.c b/arch/arm/cpu/arm1136/mx35/generic.c
index 41e9639..9fb87c3 100644
--- a/arch/arm/cpu/arm1136/mx35/generic.c
+++ b/arch/arm/cpu/arm1136/mx35/generic.c
@@ -477,11 +477,11 @@ int get_clocks(void)
 {
 #ifdef CONFIG_FSL_ESDHC
 #if CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC2_BASE_ADDR
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
 #elif CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC3_BASE_ADDR
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
 #else
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
 #endif
 #endif
 	return 0;
diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
index b991418..679273b 100644
--- a/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -229,9 +229,9 @@ int get_clocks(void)
 {
 #ifdef CONFIG_FSL_ESDHC
 #if CONFIG_SYS_FSL_ESDHC_ADDR == IMX_MMC_SDHC2_BASE
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
 #else
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
 #endif
 #endif
 	return 0;
diff --git a/arch/arm/imx-common/speed.c b/arch/arm/imx-common/speed.c
index fbf4de3..638ee1a 100644
--- a/arch/arm/imx-common/speed.c
+++ b/arch/arm/imx-common/speed.c
@@ -37,23 +37,23 @@ int get_clocks(void)
 #ifdef CONFIG_FSL_ESDHC
 #ifdef CONFIG_FSL_USDHC
 #if CONFIG_SYS_FSL_ESDHC_ADDR == USDHC2_BASE_ADDR
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
 #elif CONFIG_SYS_FSL_ESDHC_ADDR == USDHC3_BASE_ADDR
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
 #elif CONFIG_SYS_FSL_ESDHC_ADDR == USDHC4_BASE_ADDR
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
 #else
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
 #endif
 #else
 #if CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC2_BASE_ADDR
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
 #elif CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC3_BASE_ADDR
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
 #elif CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC4_BASE_ADDR
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
 #else
-	gd->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
+	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
 #endif
 #endif
 #endif
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 0d1ebfd..2f85b91 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -26,6 +26,9 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+#if defined(CONFIG_FSL_ESDHC)
+	u32 sdhc_clk;
+#endif
 #ifdef CONFIG_AT91FAMILY
 	/* "static data" needed by at91's clock.c */
 	unsigned long	cpu_clk_rate_hz;
@@ -68,9 +71,6 @@ typedef	struct	global_data {
 	unsigned long	env_addr;	/* Address  of Environment struct */
 	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	unsigned long	fb_base;	/* base address of frame buffer */
-#ifdef CONFIG_FSL_ESDHC
-	unsigned long	sdhc_clk;
-#endif
 	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	mon_len;	/* monitor len */
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index ba8b285..6be0e3a 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -478,7 +478,7 @@ int get_clocks(void)
 	gd->arch.tdm_clk = tdm_clk;
 #endif
 #if defined(CONFIG_FSL_ESDHC)
-	gd->sdhc_clk = sdhc_clk;
+	gd->arch.sdhc_clk = sdhc_clk;
 #endif
 	gd->arch.core_clk = core_clk;
 	gd->arch.i2c1_clk = i2c1_clk;
@@ -570,7 +570,8 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	       strmhz(buf, gd->arch.tdm_clk));
 #endif
 #if defined(CONFIG_FSL_ESDHC)
-	printf("  SDHC:                %-4s MHz\n", strmhz(buf, gd->sdhc_clk));
+	printf("  SDHC:                %-4s MHz\n",
+	       strmhz(buf, gd->arch.sdhc_clk));
 #endif
 #if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \
 	defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x)
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index 7173c07..297f2ed 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -428,9 +428,9 @@ int get_clocks (void)
 #if defined(CONFIG_FSL_ESDHC)
 #if defined(CONFIG_MPC8569) || defined(CONFIG_P1010) ||\
        defined(CONFIG_P1014)
-	gd->sdhc_clk = gd->bus_clk;
+	gd->arch.sdhc_clk = gd->bus_clk;
 #else
-	gd->sdhc_clk = gd->bus_clk / 2;
+	gd->arch.sdhc_clk = gd->bus_clk / 2;
 #endif
 #endif /* defined(CONFIG_FSL_ESDHC) */
 
diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index ea67537..9bf18fb 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -29,6 +29,9 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+#if defined(CONFIG_FSL_ESDHC)
+	u32 sdhc_clk;
+#endif
 #if defined(CONFIG_8xx)
 	unsigned long brg_clk;
 #endif
@@ -150,9 +153,6 @@ typedef	struct	global_data {
 	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
 	unsigned long pci_clk;
 	unsigned long   mem_clk;
-#if defined(CONFIG_FSL_ESDHC)
-	u32 sdhc_clk;
-#endif
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	env_addr;	/* Address  of Environment struct	*/
 	unsigned long	env_valid;	/* Checksum of Environment valid?	*/
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index e93e38a..7035b6b 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -583,7 +583,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
 		mmc->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
 
 	mmc->f_min = 400000;
-	mmc->f_max = MIN(gd->sdhc_clk, 52000000);
+	mmc->f_max = MIN(gd->arch.sdhc_clk, 52000000);
 
 	mmc->b_max = 0;
 	mmc_register(mmc);
@@ -598,7 +598,7 @@ int fsl_esdhc_mmc_init(bd_t *bis)
 	cfg = malloc(sizeof(struct fsl_esdhc_cfg));
 	memset(cfg, 0, sizeof(struct fsl_esdhc_cfg));
 	cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR;
-	cfg->sdhc_clk = gd->sdhc_clk;
+	cfg->sdhc_clk = gd->arch.sdhc_clk;
 	return fsl_esdhc_initialize(bis, cfg);
 }
 
@@ -616,7 +616,7 @@ void fdt_fixup_esdhc(void *blob, bd_t *bd)
 #endif
 
 	do_fixup_by_compat_u32(blob, compat, "clock-frequency",
-			       gd->sdhc_clk, 1);
+			       gd->arch.sdhc_clk, 1);
 
 	do_fixup_by_compat(blob, compat, "status", "okay",
 			   4 + 1, 1);
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 36/57] sparc: Drop kbd_status and reset_status from global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (34 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 35/57] ppc: arm: Move sdhc_clk into arch_global_data Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 37/57] m68k: Move CONFIG_EXTRA_CLOCK to arch_global_data Simon Glass
                   ` (21 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

These fields is not used on sparc, so punt them.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/sparc/include/asm/global_data.h |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/include/asm/global_data.h b/arch/sparc/include/asm/global_data.h
index a51c40b..7c3d2d5 100644
--- a/arch/sparc/include/asm/global_data.h
+++ b/arch/sparc/include/asm/global_data.h
@@ -50,7 +50,6 @@ typedef struct global_data {
 
 	phys_size_t ram_size;		/* RAM size */
 	unsigned long reloc_off;	/* Relocation Offset */
-	unsigned long reset_status;	/* reset status register at boot        */
 	unsigned long env_addr;	/* Address  of Environment struct       */
 	unsigned long env_valid;	/* Checksum of Environment valid?       */
 	unsigned long have_console;	/* serial_init() was called */
@@ -73,9 +72,6 @@ typedef struct global_data {
 	unsigned long do_mdm_init;
 	unsigned long be_quiet;
 #endif
-#ifdef CONFIG_LWMON
-	unsigned long kbd_status;
-#endif
 	void	**jt;			/* jump table */
 	char	env_buf[32];		/* buffer for getenv() before reloc. */
 	struct arch_global_data arch;	/* architecture-specific data */
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 37/57] m68k: Move CONFIG_EXTRA_CLOCK to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (35 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 36/57] sparc: Drop kbd_status and reset_status from global_data Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 38/57] mips: Move per_clk and dev_clk " Simon Glass
                   ` (20 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move inp_clk, vco_clk and flb_clk into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/m68k/cpu/mcf5227x/cpu.c        |    6 +++---
 arch/m68k/cpu/mcf5227x/speed.c      |   10 +++++-----
 arch/m68k/cpu/mcf5445x/cpu.c        |   10 +++++-----
 arch/m68k/cpu/mcf5445x/speed.c      |   10 +++++-----
 arch/m68k/include/asm/global_data.h |   10 +++++-----
 arch/m68k/lib/board.c               |    6 +++---
 6 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/arch/m68k/cpu/mcf5227x/cpu.c b/arch/m68k/cpu/mcf5227x/cpu.c
index 3a0ab97..705bd44 100644
--- a/arch/m68k/cpu/mcf5227x/cpu.c
+++ b/arch/m68k/cpu/mcf5227x/cpu.c
@@ -68,10 +68,10 @@ int checkcpu(void)
 		printf("       CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n",
 		       strmhz(buf1, gd->cpu_clk),
 		       strmhz(buf2, gd->bus_clk),
-		       strmhz(buf3, gd->flb_clk));
+		       strmhz(buf3, gd->arch.flb_clk));
 		printf("       INP CLK %s MHz VCO CLK %s MHz\n",
-		       strmhz(buf1, gd->inp_clk),
-		       strmhz(buf2, gd->vco_clk));
+		       strmhz(buf1, gd->arch.inp_clk),
+		       strmhz(buf2, gd->arch.vco_clk));
 	}
 
 	return 0;
diff --git a/arch/m68k/cpu/mcf5227x/speed.c b/arch/m68k/cpu/mcf5227x/speed.c
index c1d5930..98f554a 100644
--- a/arch/m68k/cpu/mcf5227x/speed.c
+++ b/arch/m68k/cpu/mcf5227x/speed.c
@@ -114,24 +114,24 @@ int get_clocks(void)
 			    ((in_be32(&pll->pcr) & 0xFF000000) >> 24) *
 			    CONFIG_SYS_INPUT_CLKSRC;
 		}
-		gd->vco_clk = vco;	/* Vco clock */
+		gd->arch.vco_clk = vco;	/* Vco clock */
 	} else if (bootmode == 3) {
 		/* serial mode */
 		vco = ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;
-		gd->vco_clk = vco;	/* Vco clock */
+		gd->arch.vco_clk = vco;	/* Vco clock */
 	}
 
 	if ((in_be16(&ccm->ccr) & CCM_MISCCR_LIMP) == CCM_MISCCR_LIMP) {
 		/* Limp mode */
 	} else {
-		gd->inp_clk = CONFIG_SYS_INPUT_CLKSRC;	/* Input clock */
+		gd->arch.inp_clk = CONFIG_SYS_INPUT_CLKSRC; /* Input clock */
 
 		temp = (in_be32(&pll->pcr) & PLL_PCR_OUTDIV1_MASK) + 1;
 		gd->cpu_clk = vco / temp;	/* cpu clock */
 
 		temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV2_MASK) >> 4) + 1;
-		gd->flb_clk = vco / temp;	/* flexbus clock */
-		gd->bus_clk = gd->flb_clk;
+		gd->arch.flb_clk = vco / temp;	/* flexbus clock */
+		gd->bus_clk = gd->arch.flb_clk;
 	}
 
 #ifdef CONFIG_FSL_I2C
diff --git a/arch/m68k/cpu/mcf5445x/cpu.c b/arch/m68k/cpu/mcf5445x/cpu.c
index b612cda..08930f4 100644
--- a/arch/m68k/cpu/mcf5445x/cpu.c
+++ b/arch/m68k/cpu/mcf5445x/cpu.c
@@ -101,16 +101,16 @@ int checkcpu(void)
 		printf("       CPU CLK %s MHz BUS CLK %s MHz FLB CLK %s MHz\n",
 		       strmhz(buf1, gd->cpu_clk),
 		       strmhz(buf2, gd->bus_clk),
-		       strmhz(buf3, gd->flb_clk));
+		       strmhz(buf3, gd->arch.flb_clk));
 #ifdef CONFIG_PCI
 		printf("       PCI CLK %s MHz INP CLK %s MHz VCO CLK %s MHz\n",
 		       strmhz(buf1, gd->pci_clk),
-		       strmhz(buf2, gd->inp_clk),
-		       strmhz(buf3, gd->vco_clk));
+		       strmhz(buf2, gd->arch.inp_clk),
+		       strmhz(buf3, gd->arch.vco_clk));
 #else
 		printf("       INP CLK %s MHz VCO CLK %s MHz\n",
-		       strmhz(buf1, gd->inp_clk),
-		       strmhz(buf2, gd->vco_clk));
+		       strmhz(buf1, gd->arch.inp_clk),
+		       strmhz(buf2, gd->arch.vco_clk));
 #endif
 	}
 
diff --git a/arch/m68k/cpu/mcf5445x/speed.c b/arch/m68k/cpu/mcf5445x/speed.c
index b7dbc65..aa73e1f 100644
--- a/arch/m68k/cpu/mcf5445x/speed.c
+++ b/arch/m68k/cpu/mcf5445x/speed.c
@@ -233,7 +233,7 @@ void setup_5445x_clocks(void)
 
 			out_be32(&pll->pcr, pcrvalue);
 		}
-		gd->vco_clk = vco;	/* Vco clock */
+		gd->arch.vco_clk = vco;	/* Vco clock */
 	} else if (bootmode == 2) {
 		/* Normal mode */
 		vco =  ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;
@@ -244,17 +244,17 @@ void setup_5445x_clocks(void)
 			out_be32(&pll->pcr, pcrvalue);
 			vco = ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;
 		}
-		gd->vco_clk = vco;	/* Vco clock */
+		gd->arch.vco_clk = vco;	/* Vco clock */
 	} else if (bootmode == 3) {
 		/* serial mode */
 		vco =  ((in_be32(&pll->pcr) & 0xFF000000) >> 24) * CONFIG_SYS_INPUT_CLKSRC;
-		gd->vco_clk = vco;	/* Vco clock */
+		gd->arch.vco_clk = vco;	/* Vco clock */
 	}
 
 	if ((in_be16(&ccm->ccr) & CCM_MISCCR_LIMP) == CCM_MISCCR_LIMP) {
 		/* Limp mode */
 	} else {
-		gd->inp_clk = CONFIG_SYS_INPUT_CLKSRC;	/* Input clock */
+		gd->arch.inp_clk = CONFIG_SYS_INPUT_CLKSRC; /* Input clock */
 
 		temp = (in_be32(&pll->pcr) & PLL_PCR_OUTDIV1_MASK) + 1;
 		gd->cpu_clk = vco / temp;	/* cpu clock */
@@ -263,7 +263,7 @@ void setup_5445x_clocks(void)
 		gd->bus_clk = vco / temp;	/* bus clock */
 
 		temp = ((in_be32(&pll->pcr) & PLL_PCR_OUTDIV3_MASK) >> 8) + 1;
-		gd->flb_clk = vco / temp;	/* FlexBus clock */
+		gd->arch.flb_clk = vco / temp;	/* FlexBus clock */
 
 #ifdef CONFIG_PCI
 		if (bPci) {
diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h
index d9be8b1..9f37dcc 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -30,6 +30,11 @@ struct arch_global_data {
 	unsigned long	i2c1_clk;
 	unsigned long	i2c2_clk;
 #endif
+#ifdef CONFIG_EXTRA_CLOCK
+	unsigned long inp_clk;
+	unsigned long vco_clk;
+	unsigned long flb_clk;
+#endif
 };
 
 /*
@@ -49,11 +54,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_PCI
 	unsigned long	pci_clk;
 #endif
-#ifdef CONFIG_EXTRA_CLOCK
-	unsigned long	inp_clk;
-	unsigned long	vco_clk;
-	unsigned long	flb_clk;
-#endif
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	reset_status;	/* reset status register at boot	*/
diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c
index 02d73fd..93be089 100644
--- a/arch/m68k/lib/board.c
+++ b/arch/m68k/lib/board.c
@@ -349,9 +349,9 @@ board_init_f (ulong bootflag)
 	bd->bi_pcifreq = gd->pci_clk;		/* PCI Freq in Hz */
 #endif
 #ifdef CONFIG_EXTRA_CLOCK
-	bd->bi_inpfreq = gd->inp_clk;		/* input Freq in Hz */
-	bd->bi_vcofreq = gd->vco_clk;		/* vco Freq in Hz */
-	bd->bi_flbfreq = gd->flb_clk;		/* flexbus Freq in Hz */
+	bd->bi_inpfreq = gd->arch.inp_clk;		/* input Freq in Hz */
+	bd->bi_vcofreq = gd->arch.vco_clk;		/* vco Freq in Hz */
+	bd->bi_flbfreq = gd->arch.flb_clk;		/* flexbus Freq in Hz */
 #endif
 	bd->bi_baudrate = gd->baudrate;	/* Console Baudrate     */
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 38/57] mips: Move per_clk and dev_clk to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (36 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 37/57] m68k: Move CONFIG_EXTRA_CLOCK to arch_global_data Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 39/57] avr32: Move stack_end " Simon Glass
                   ` (19 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move these field into arch_global_data and tidy up. The other
CONFIG_JZSOC fields are used by various architectures, so just remove
the #ifdef bracketing for these.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/mips/include/asm/global_data.h |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h
index 99949e1..fdd099e 100644
--- a/arch/mips/include/asm/global_data.h
+++ b/arch/mips/include/asm/global_data.h
@@ -28,6 +28,11 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+#ifdef CONFIG_JZSOC
+	/* There are other clocks in the jz4740 */
+	unsigned long per_clk;	/* Peripheral bus clock */
+	unsigned long dev_clk;	/* Device clock */
+#endif
 };
 
 /*
@@ -41,13 +46,9 @@ struct arch_global_data {
 typedef	struct	global_data {
 	bd_t		*bd;
 	unsigned long	flags;
-#ifdef CONFIG_JZSOC
-	/* There are other clocks in the jz4740 */
 	unsigned long	cpu_clk;	/* CPU core clock */
 	unsigned long	sys_clk;	/* System bus clock */
-	unsigned long	per_clk;	/* Peripheral bus clock */
 	unsigned long	mem_clk;	/* Memory bus clock */
-	unsigned long	dev_clk;	/* Device clock */
 	/* "static data" needed by most of timer.c */
 	unsigned long	tbl;
 	unsigned long	lastinc;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 39/57] avr32: Move stack_end to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (37 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 38/57] mips: Move per_clk and dev_clk " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 40/57] avr32: Move cpu_hz " Simon Glass
                   ` (18 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/avr32/cpu/exception.c           |    6 +++---
 arch/avr32/include/asm/global_data.h |    2 +-
 arch/avr32/lib/board.c               |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/avr32/cpu/exception.c b/arch/avr32/cpu/exception.c
index b21ef1f..828fc00 100644
--- a/arch/avr32/cpu/exception.c
+++ b/arch/avr32/cpu/exception.c
@@ -112,11 +112,11 @@ void do_unknown_exception(unsigned int ecr, struct pt_regs *regs)
 	printf("CPU Mode: %s\n", cpu_modes[mode]);
 
 	/* Avoid exception loops */
-	if (regs->sp < (gd->stack_end - CONFIG_STACKSIZE)
-			|| regs->sp >= gd->stack_end)
+	if (regs->sp < (gd->arch.stack_end - CONFIG_STACKSIZE)
+			|| regs->sp >= gd->arch.stack_end)
 		printf("\nStack pointer seems bogus, won't do stack dump\n");
 	else
-		dump_mem("\nStack: ", regs->sp, gd->stack_end);
+		dump_mem("\nStack: ", regs->sp, gd->arch.stack_end);
 
 	panic("Unhandled exception\n");
 }
diff --git a/arch/avr32/include/asm/global_data.h b/arch/avr32/include/asm/global_data.h
index 236a9da..3be8628 100644
--- a/arch/avr32/include/asm/global_data.h
+++ b/arch/avr32/include/asm/global_data.h
@@ -24,6 +24,7 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+	unsigned long stack_end;	/* highest stack address */
 };
 
 /*
@@ -38,7 +39,6 @@ typedef	struct	global_data {
 	bd_t		*bd;
 	unsigned long	flags;
 	unsigned int	baudrate;
-	unsigned long	stack_end;	/* highest stack address */
 	unsigned long	have_console;	/* serial_init() was called */
 #ifdef CONFIG_PRE_CONSOLE_BUFFER
 	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
index e3287c4..d3c8cb7 100644
--- a/arch/avr32/lib/board.c
+++ b/arch/avr32/lib/board.c
@@ -231,7 +231,7 @@ void board_init_f(ulong board_type)
 
 	/* And finally, a new, bigger stack. */
 	new_sp = (unsigned long *)addr;
-	gd->stack_end = addr;
+	gd->arch.stack_end = addr;
 	*(--new_sp) = 0;
 	*(--new_sp) = 0;
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 40/57] avr32: Move cpu_hz to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (38 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 39/57] avr32: Move stack_end " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 41/57] sandbox: Move ram_buf " Simon Glass
                   ` (17 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/avr32/cpu/cpu.c                 |    4 ++--
 arch/avr32/cpu/interrupts.c          |    6 +++---
 arch/avr32/include/asm/global_data.h |    2 +-
 arch/avr32/lib/bootm.c               |    2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/avr32/cpu/cpu.c b/arch/avr32/cpu/cpu.c
index 7907837..9d82ca4 100644
--- a/arch/avr32/cpu/cpu.c
+++ b/arch/avr32/cpu/cpu.c
@@ -47,7 +47,7 @@ int cpu_init(void)
 {
 	extern void _evba(void);
 
-	gd->cpu_hz = CONFIG_SYS_OSC0_HZ;
+	gd->arch.cpu_hz = CONFIG_SYS_OSC0_HZ;
 
 	/* TODO: Move somewhere else, but needs to be run before we
 	 * increase the clock frequency. */
@@ -59,7 +59,7 @@ int cpu_init(void)
 	clk_init();
 
 	/* Update the CPU speed according to the PLL configuration */
-	gd->cpu_hz = get_cpu_clk_rate();
+	gd->arch.cpu_hz = get_cpu_clk_rate();
 
 	/* Set up the exception handler table and enable exceptions */
 	sysreg_write(EVBA, (unsigned long)&_evba);
diff --git a/arch/avr32/cpu/interrupts.c b/arch/avr32/cpu/interrupts.c
index 49a00f1..d87c6e1 100644
--- a/arch/avr32/cpu/interrupts.c
+++ b/arch/avr32/cpu/interrupts.c
@@ -46,7 +46,7 @@ static unsigned long tb_factor;
 
 unsigned long get_tbclk(void)
 {
-	return gd->cpu_hz;
+	return gd->arch.cpu_hz;
 }
 
 unsigned long long get_ticks(void)
@@ -115,8 +115,8 @@ int timer_init(void)
 	sysreg_write(COUNT, 0);
 
 	tmp = (u64)CONFIG_SYS_HZ << 32;
-	tmp += gd->cpu_hz / 2;
-	do_div(tmp, gd->cpu_hz);
+	tmp += gd->arch.cpu_hz / 2;
+	do_div(tmp, gd->arch.cpu_hz);
 	tb_factor = (u32)tmp;
 
 	if (set_interrupt_handler(0, &timer_interrupt_handler, 3))
diff --git a/arch/avr32/include/asm/global_data.h b/arch/avr32/include/asm/global_data.h
index 3be8628..aeb6605 100644
--- a/arch/avr32/include/asm/global_data.h
+++ b/arch/avr32/include/asm/global_data.h
@@ -25,6 +25,7 @@
 /* Architecture-specific global data */
 struct arch_global_data {
 	unsigned long stack_end;	/* highest stack address */
+	unsigned long cpu_hz;		/* cpu core clock frequency */
 };
 
 /*
@@ -46,7 +47,6 @@ typedef	struct	global_data {
 	unsigned long	reloc_off;	/* Relocation Offset */
 	unsigned long	env_addr;	/* Address of env struct */
 	unsigned long	env_valid;	/* Checksum of env valid? */
-	unsigned long	cpu_hz;		/* cpu core clock frequency */
 #if defined(CONFIG_LCD)
 	void		*fb_base;	/* framebuffer address */
 #endif
diff --git a/arch/avr32/lib/bootm.c b/arch/avr32/lib/bootm.c
index 74ebeca..87f3f9c 100644
--- a/arch/avr32/lib/bootm.c
+++ b/arch/avr32/lib/bootm.c
@@ -109,7 +109,7 @@ static struct tag *setup_clock_tags(struct tag *params)
 	params->hdr.size = tag_size(tag_clock);
 	params->u.clock.clock_id = ACLOCK_BOOTCPU;
 	params->u.clock.clock_flags = 0;
-	params->u.clock.clock_hz = gd->cpu_hz;
+	params->u.clock.clock_hz = gd->arch.cpu_hz;
 
 #ifdef CONFIG_AT32AP7000
 	/*
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 41/57] sandbox: Move ram_buf to arch_global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (39 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 40/57] avr32: Move cpu_hz " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 42/57] Add generic global_data Simon Glass
                   ` (16 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/sandbox/cpu/cpu.c                 |    2 +-
 arch/sandbox/include/asm/global_data.h |    2 +-
 arch/sandbox/lib/board.c               |    6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index d7684d3..b2788d5 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -54,7 +54,7 @@ int cleanup_before_linux(void)
 
 void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
 {
-	return (void *)(gd->ram_buf + paddr);
+	return (void *)(gd->arch.ram_buf + paddr);
 }
 
 void flush_dcache_range(unsigned long start, unsigned long stop)
diff --git a/arch/sandbox/include/asm/global_data.h b/arch/sandbox/include/asm/global_data.h
index f33f465..3ba7ed5 100644
--- a/arch/sandbox/include/asm/global_data.h
+++ b/arch/sandbox/include/asm/global_data.h
@@ -28,6 +28,7 @@
 
 /* Architecture-specific global data */
 struct arch_global_data {
+	u8		*ram_buf;	/* emulated RAM buffer */
 };
 
 /*
@@ -46,7 +47,6 @@ typedef	struct global_data {
 	unsigned long	env_addr;	/* Address  of Environment struct */
 	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	unsigned long	fb_base;	/* base address of frame buffer */
-	u8		*ram_buf;	/* emulated RAM buffer */
 	phys_size_t	ram_size;	/* RAM size */
 	const void	*fdt_blob;	/* Our device tree, NULL if none */
 	void		**jt;		/* jump table */
diff --git a/arch/sandbox/lib/board.c b/arch/sandbox/lib/board.c
index 83858c1..3752fab 100644
--- a/arch/sandbox/lib/board.c
+++ b/arch/sandbox/lib/board.c
@@ -174,7 +174,7 @@ void board_init_f(ulong bootflag)
 	mem = os_malloc(CONFIG_SYS_SDRAM_SIZE);
 
 	assert(mem);
-	gd->ram_buf = mem;
+	gd->arch.ram_buf = mem;
 	addr = (ulong)(mem + size);
 
 	/*
@@ -227,8 +227,8 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #endif
 
 	/* The Malloc area is at the top of simulated DRAM */
-	mem_malloc_init((ulong)gd->ram_buf + gd->ram_size - TOTAL_MALLOC_LEN,
-			TOTAL_MALLOC_LEN);
+	mem_malloc_init((ulong)gd->arch.ram_buf + gd->ram_size -
+			TOTAL_MALLOC_LEN, TOTAL_MALLOC_LEN);
 
 	/* initialize environment */
 	env_relocate();
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 42/57] Add generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (40 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 41/57] sandbox: Move ram_buf " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 43/57] Only use fb_base if we have a display Simon Glass
                   ` (15 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Add a generic global_data structure which all archs will eventually
use.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 include/asm-generic/global_data.h |  102 +++++++++++++++++++++++++++++++++++++
 1 files changed, 102 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-generic/global_data.h

diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
new file mode 100644
index 0000000..1243f6e
--- /dev/null
+++ b/include/asm-generic/global_data.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2012 The Chromium OS Authors.
+ * (C) Copyright 2002-2010
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef	__ASM_GENERIC_GBL_DATA_H
+#define __ASM_GENERIC_GBL_DATA_H
+/*
+ * The following data structure is placed in some memory which is
+ * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
+ * some locked parts of the data cache) to allow for a minimum set of
+ * global variables during system initialization (until we have set
+ * up the memory controller so that we can use RAM).
+ *
+ * Keep it *SMALL* and remember to set GENERATED_GBL_DATA_SIZE > sizeof(gd_t)
+ *
+ * Each architecture has its own private fields. For now all are private
+ */
+
+#ifndef __ASSEMBLY__
+typedef struct global_data {
+	bd_t *bd;
+	unsigned long flags;
+	unsigned long baudrate;
+	unsigned long cpu_clk;	/* CPU clock in Hz!		*/
+	unsigned long bus_clk;
+	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
+	unsigned long pci_clk;
+	unsigned long mem_clk;
+#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
+	unsigned long fb_base;	/* Base address of framebuffer mem */
+#endif
+#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
+	unsigned long post_log_word;  /* Record POST activities */
+	unsigned long post_log_res; /* success of POST test */
+	unsigned long post_init_f_time;  /* When post_init_f started */
+#endif
+#ifdef CONFIG_BOARD_TYPES
+	unsigned long board_type;
+#endif
+	unsigned long have_console;	/* serial_init() was called */
+#ifdef CONFIG_PRE_CONSOLE_BUFFER
+	unsigned long precon_buf_idx;	/* Pre-Console buffer index */
+#endif
+#ifdef CONFIG_MODEM_SUPPORT
+	unsigned long do_mdm_init;
+	unsigned long be_quiet;
+#endif
+	unsigned long env_addr;	/* Address  of Environment struct */
+	unsigned long env_valid;	/* Checksum of Environment valid? */
+
+	/* TODO: is this the same as relocaddr, or something else? */
+	unsigned long dest_addr;	/* Post-relocation address of U-Boot */
+	unsigned long dest_addr_sp;
+	unsigned long ram_top;	/* Top address of RAM used by U-Boot */
+
+	unsigned long relocaddr;	/* Start address of U-Boot in RAM */
+	phys_size_t ram_size;	/* RAM size */
+	unsigned long mon_len;	/* monitor len */
+	unsigned long irq_sp;		/* irq stack pointer */
+	unsigned long start_addr_sp;	/* start_addr_stackpointer */
+	unsigned long reloc_off;
+	struct global_data *new_gd;	/* relocated global data */
+	const void *fdt_blob;	/* Our device tree, NULL if none */
+	void **jt;		/* jump table */
+	char env_buf[32];	/* buffer for getenv() before reloc. */
+	struct arch_global_data arch;	/* architecture-specific data */
+} gd_t;
+#endif
+
+/*
+ * Global Data Flags
+ */
+#define	GD_FLG_RELOC		0x00001	/* Code was relocated to RAM	   */
+#define	GD_FLG_DEVINIT		0x00002	/* Devices have been initialized   */
+#define	GD_FLG_SILENT		0x00004	/* Silent mode			   */
+#define	GD_FLG_POSTFAIL		0x00008	/* Critical POST test failed	   */
+#define	GD_FLG_POSTSTOP		0x00010	/* POST seqeunce aborted	   */
+#define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized */
+#define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)	   */
+#define GD_FLG_ENV_READY	0x00080	/* Env. imported into hash table   */
+
+#endif /* __ASM_GENERIC_GBL_DATA_H */
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 43/57] Only use fb_base if we have a display
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (41 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 42/57] Add generic global_data Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 44/57] arm: Use generic global_data Simon Glass
                   ` (14 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

The ideal of having a frame buffer when there isn't a display is not
that useful. Change the bdinfo command to expect this only when we
have an lcd or video display.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 common/cmd_bdinfo.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 82a3693..6800c4f 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -377,7 +377,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_num("reloc off", gd->reloc_off);
 	print_num("irq_sp", gd->irq_sp);	/* irq stack pointer */
 	print_num("sp start ", gd->start_addr_sp);
+#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
 	print_num("FB base  ", gd->fb_base);
+#endif
 	/*
 	 * TODO: Currently only support for davinci SOC's is added.
 	 * Remove this check once all the board implement this.
@@ -463,7 +465,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_eth(0);
 	printf("ip_addr     = %s\n", getenv("ipaddr"));
 #endif
+#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
 	print_num("FB base  ", gd->fb_base);
+#endif
 	return 0;
 }
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 44/57] arm: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (42 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 43/57] Only use fb_base if we have a display Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 45/57] avr32: " Simon Glass
                   ` (13 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/include/asm/global_data.h |   38 +-----------------------------------
 1 files changed, 1 insertions(+), 37 deletions(-)

diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 2f85b91..8ee0883 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -52,43 +52,7 @@ struct arch_global_data {
 #endif
 };
 
-/*
- * The following data structure is placed in some memory which is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct	global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid? */
-	unsigned long	fb_base;	/* base address of frame buffer */
-	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
-	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	mon_len;	/* monitor len */
-	unsigned long	irq_sp;		/* irq stack pointer */
-	unsigned long	start_addr_sp;	/* start_addr_stackpointer */
-	unsigned long	reloc_off;
-	const void	*fdt_blob;	/* Our device tree, NULL if none */
-	void		**jt;		/* jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-	unsigned long	post_log_word; /* Record POST activities */
-	unsigned long	post_log_res; /* success of POST test */
-	unsigned long	post_init_f_time; /* When post_init_f started */
-#endif
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 45/57] avr32: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (43 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 44/57] arm: Use generic global_data Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 46/57] blackfin: " Simon Glass
                   ` (12 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move avr32 over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/avr32/include/asm/global_data.h |   29 +----------------------------
 1 files changed, 1 insertions(+), 28 deletions(-)

diff --git a/arch/avr32/include/asm/global_data.h b/arch/avr32/include/asm/global_data.h
index aeb6605..a71f199 100644
--- a/arch/avr32/include/asm/global_data.h
+++ b/arch/avr32/include/asm/global_data.h
@@ -28,34 +28,7 @@ struct arch_global_data {
 	unsigned long cpu_hz;		/* cpu core clock frequency */
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct	global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-	unsigned long	reloc_off;	/* Relocation Offset */
-	unsigned long	env_addr;	/* Address of env struct */
-	unsigned long	env_valid;	/* Checksum of env valid? */
-#if defined(CONFIG_LCD)
-	void		*fb_base;	/* framebuffer address */
-#endif
-	void		**jt;		/* jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5")
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 46/57] blackfin: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (44 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 45/57] avr32: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 47/57] m68k: " Simon Glass
                   ` (11 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move blackfin over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/blackfin/include/asm/global_data.h |   32 +------------------------------
 1 files changed, 1 insertions(+), 31 deletions(-)

diff --git a/arch/blackfin/include/asm/global_data.h b/arch/blackfin/include/asm/global_data.h
index 109069f..c2c4d4d 100644
--- a/arch/blackfin/include/asm/global_data.h
+++ b/arch/blackfin/include/asm/global_data.h
@@ -34,37 +34,7 @@
 struct arch_global_data {
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-typedef struct global_data {
-	bd_t *bd;
-	unsigned long flags;
-	unsigned long board_type;
-	unsigned int baudrate;
-	unsigned long have_console;	/* serial_init() was called */
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-	phys_size_t ram_size;		/* RAM size */
-	unsigned long env_addr;	/* Address  of Environment struct */
-	unsigned long env_valid;	/* Checksum of Environment valid? */
-#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-	unsigned long post_log_word;	/* Record POST activities */
-	unsigned long post_log_res; 	/* success of POST test */
-	unsigned long post_init_f_time;	/* When post_init_f started */
-#endif
-
-	void	**jt;			/* jump table */
-	char	env_buf[32];		/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("P3")
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 47/57] m68k: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (45 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 46/57] blackfin: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 48/57] microblaze: " Simon Glass
                   ` (10 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move m68k over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/m68k/include/asm/global_data.h |   39 +----------------------------------
 1 files changed, 1 insertions(+), 38 deletions(-)

diff --git a/arch/m68k/include/asm/global_data.h b/arch/m68k/include/asm/global_data.h
index 9f37dcc..3ec298f 100644
--- a/arch/m68k/include/asm/global_data.h
+++ b/arch/m68k/include/asm/global_data.h
@@ -37,44 +37,7 @@ struct arch_global_data {
 #endif
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct	global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
-	unsigned long	bus_clk;
-#ifdef CONFIG_PCI
-	unsigned long	pci_clk;
-#endif
-	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	reloc_off;	/* Relocation Offset */
-	unsigned long	reset_status;	/* reset status register at boot	*/
-	unsigned long	env_addr;	/* Address  of Environment struct	*/
-	unsigned long	env_valid;	/* Checksum of Environment valid?	*/
-	unsigned long	have_console;	/* serial_init() was called		*/
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
-	unsigned long	fb_base;	/* Base addr of framebuffer memory */
-#endif
-#ifdef CONFIG_BOARD_TYPES
-	unsigned long	board_type;
-#endif
-	void		**jt;		/* Standalone app jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #if 0
 extern gd_t *global_data;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 48/57] microblaze: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (46 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 47/57] m68k: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 49/57] mips: " Simon Glass
                   ` (9 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move microblaze over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/microblaze/include/asm/global_data.h |   27 +--------------------------
 1 files changed, 1 insertions(+), 26 deletions(-)

diff --git a/arch/microblaze/include/asm/global_data.h b/arch/microblaze/include/asm/global_data.h
index 025131c..89dcef7 100644
--- a/arch/microblaze/include/asm/global_data.h
+++ b/arch/microblaze/include/asm/global_data.h
@@ -29,32 +29,7 @@
 struct arch_global_data {
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct	global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-	unsigned long	env_addr;	/* Address  of Environment struct */
-	const void	*fdt_blob;	/* Our device tree, NULL if none */
-	unsigned long	env_valid;	/* Checksum of Environment valid? */
-	unsigned long	fb_base;	/* base address of frame buffer */
-	void		**jt;		/* jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r31")
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 49/57] mips: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (47 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 48/57] microblaze: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 50/57] nds32: " Simon Glass
                   ` (8 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move mips over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/mips/include/asm/global_data.h |   34 +---------------------------------
 1 files changed, 1 insertions(+), 33 deletions(-)

diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h
index fdd099e..b39737f 100644
--- a/arch/mips/include/asm/global_data.h
+++ b/arch/mips/include/asm/global_data.h
@@ -35,39 +35,7 @@ struct arch_global_data {
 #endif
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct	global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned long	cpu_clk;	/* CPU core clock */
-	unsigned long	sys_clk;	/* System bus clock */
-	unsigned long	mem_clk;	/* Memory bus clock */
-	/* "static data" needed by most of timer.c */
-	unsigned long	tbl;
-	unsigned long	lastinc;
-#endif
-	unsigned int	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	reloc_off;	/* Relocation Offset */
-	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid? */
-	void		**jt;		/* jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("k0")
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 50/57] nds32: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (48 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 49/57] mips: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 51/57] nios2: " Simon Glass
                   ` (7 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move nds32 over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/nds32/include/asm/global_data.h |   32 +-------------------------------
 1 files changed, 1 insertions(+), 31 deletions(-)

diff --git a/arch/nds32/include/asm/global_data.h b/arch/nds32/include/asm/global_data.h
index e693b01..4927d52 100644
--- a/arch/nds32/include/asm/global_data.h
+++ b/arch/nds32/include/asm/global_data.h
@@ -38,37 +38,7 @@
 struct arch_global_data {
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
-
-	unsigned long	reloc_off;	/* Relocation Offset */
-	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid? */
-	unsigned long	fb_base;	/* base address of frame buffer */
-
-	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
-	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	mon_len;	/* monitor len */
-	unsigned long	irq_sp;		/* irq stack pointer */
-	unsigned long	start_addr_sp;	/* start_addr_stackpointer */
-
-	void		**jt;		/* jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #ifdef CONFIG_GLOBAL_DATA_NOT_REG10
 extern volatile gd_t g_gd;
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 51/57] nios2: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (49 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 50/57] nds32: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-20  4:01   ` Thomas Chou
  2012-11-16 21:20 ` [U-Boot] [PATCH 52/57] openrisc: " Simon Glass
                   ` (6 subsequent siblings)
  57 siblings, 1 reply; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move nios2 over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/nios2/include/asm/global_data.h |   24 +-----------------------
 1 files changed, 1 insertions(+), 23 deletions(-)

diff --git a/arch/nios2/include/asm/global_data.h b/arch/nios2/include/asm/global_data.h
index cf8597b..39c5700 100644
--- a/arch/nios2/include/asm/global_data.h
+++ b/arch/nios2/include/asm/global_data.h
@@ -27,29 +27,7 @@
 struct arch_global_data {
 };
 
-typedef	struct	global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
-	unsigned long	have_console;	/* serial_init() was called */
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid */
-#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-	unsigned long	post_log_word;	/* Record POST activities */
-	unsigned long	post_log_res; /* success of POST test */
-	unsigned long	post_init_f_time; /* When post_init_f started */
-#endif
-	void		**jt;		/* Standalone app jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("gp")
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 52/57] openrisc: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (50 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 51/57] nios2: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 53/57] powerpc: " Simon Glass
                   ` (5 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move openrisc over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/openrisc/include/asm/global_data.h |   25 +------------------------
 1 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/arch/openrisc/include/asm/global_data.h b/arch/openrisc/include/asm/global_data.h
index b478afa..d267ccd 100644
--- a/arch/openrisc/include/asm/global_data.h
+++ b/arch/openrisc/include/asm/global_data.h
@@ -29,30 +29,7 @@
 struct arch_global_data {
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef struct global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	cpu_clk;	/* CPU clock in Hz! */
-	unsigned long	have_console;	/* serial_init() was called */
-	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid? */
-	unsigned long	fb_base;	/* base address of frame buffer */
-	void		**jt;		/* jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 /* OR32 GCC already has r10 set as fixed-use */
 #define DECLARE_GLOBAL_DATA_PTR	register volatile gd_t *gd asm ("r10")
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 53/57] powerpc: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (51 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 52/57] openrisc: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 54/57] sandbox: " Simon Glass
                   ` (4 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move powerpc over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/powerpc/include/asm/global_data.h |   47 +-------------------------------
 1 files changed, 1 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h
index 9bf18fb..d5db854 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -136,52 +136,7 @@ struct arch_global_data {
 #endif
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct	global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	cpu_clk;	/* CPU clock in Hz! */
-	unsigned long	bus_clk;
-	/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
-	unsigned long pci_clk;
-	unsigned long   mem_clk;
-	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	env_addr;	/* Address  of Environment struct	*/
-	unsigned long	env_valid;	/* Checksum of Environment valid?	*/
-	unsigned long	have_console;	/* serial_init() was called		*/
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
-#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
-	unsigned long	fb_base;	/* Base address of framebuffer memory	*/
-#endif
-#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-	unsigned long	post_log_word;  /* Record POST activities */
-	unsigned long	post_log_res; /* success of POST test */
-	unsigned long	post_init_f_time;  /* When post_init_f started */
-#endif
-#ifdef CONFIG_BOARD_TYPES
-	unsigned long	board_type;
-#endif
-#ifdef CONFIG_MODEM_SUPPORT
-	unsigned long do_mdm_init;
-	unsigned long be_quiet;
-#endif
-	void		**jt;		/* jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #if 1
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 54/57] sandbox: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (52 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 53/57] powerpc: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 55/57] sh: " Simon Glass
                   ` (3 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move sandbox over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/sandbox/include/asm/global_data.h |   25 +------------------------
 1 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/arch/sandbox/include/asm/global_data.h b/arch/sandbox/include/asm/global_data.h
index 3ba7ed5..3bedf77 100644
--- a/arch/sandbox/include/asm/global_data.h
+++ b/arch/sandbox/include/asm/global_data.h
@@ -31,30 +31,7 @@ struct arch_global_data {
 	u8		*ram_buf;	/* emulated RAM buffer */
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
-	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid? */
-	unsigned long	fb_base;	/* base address of frame buffer */
-	phys_size_t	ram_size;	/* RAM size */
-	const void	*fdt_blob;	/* Our device tree, NULL if none */
-	void		**jt;		/* jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #define DECLARE_GLOBAL_DATA_PTR     extern gd_t *gd
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 55/57] sh: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (53 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 54/57] sandbox: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 56/57] sparc: " Simon Glass
                   ` (2 subsequent siblings)
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move sh over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/sh/include/asm/global_data.h |   20 +-------------------
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/arch/sh/include/asm/global_data.h b/arch/sh/include/asm/global_data.h
index db85d4d..0360230 100644
--- a/arch/sh/include/asm/global_data.h
+++ b/arch/sh/include/asm/global_data.h
@@ -31,25 +31,7 @@
 struct arch_global_data {
 };
 
-typedef	struct global_data
-{
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	cpu_clk;	/* CPU clock in Hz! */
-	unsigned long	have_console;	/* serial_init() was called */
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-	phys_size_t	ram_size;	/* RAM size */
-	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid */
-	void		**jt;		/* Standalone app jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #define DECLARE_GLOBAL_DATA_PTR	register gd_t *gd asm ("r13")
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 56/57] sparc: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (54 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 55/57] sh: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-16 21:20 ` [U-Boot] [PATCH 57/57] x86: " Simon Glass
  2012-11-20  7:25 ` [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Wolfgang Denk
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move sparc over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/sparc/include/asm/global_data.h |   46 +---------------------------------
 1 files changed, 1 insertions(+), 45 deletions(-)

diff --git a/arch/sparc/include/asm/global_data.h b/arch/sparc/include/asm/global_data.h
index 7c3d2d5..9f019b1 100644
--- a/arch/sparc/include/asm/global_data.h
+++ b/arch/sparc/include/asm/global_data.h
@@ -33,51 +33,7 @@
 struct arch_global_data {
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef struct global_data {
-	bd_t *bd;
-	unsigned long flags;
-	unsigned int baudrate;
-	unsigned long cpu_clk;	/* CPU clock in Hz!             */
-	unsigned long bus_clk;
-
-	phys_size_t ram_size;		/* RAM size */
-	unsigned long reloc_off;	/* Relocation Offset */
-	unsigned long env_addr;	/* Address  of Environment struct       */
-	unsigned long env_valid;	/* Checksum of Environment valid?       */
-	unsigned long have_console;	/* serial_init() was called */
-
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
-#endif
-#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
-	unsigned long fb_base;	/* Base address of framebuffer memory   */
-#endif
-#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-	unsigned long post_log_word;	/* Record POST activities */
-	unsigned long post_log_res;	/* success of POST test */
-	unsigned long post_init_f_time;	/* When post_init_f started */
-#endif
-#ifdef CONFIG_BOARD_TYPES
-	unsigned long board_type;
-#endif
-#ifdef CONFIG_MODEM_SUPPORT
-	unsigned long do_mdm_init;
-	unsigned long be_quiet;
-#endif
-	void	**jt;			/* jump table */
-	char	env_buf[32];		/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
-
-#include <asm-generic/global_data_flags.h>
+#include <asm-generic/global_data.h>
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("%g7")
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 57/57] x86: Use generic global_data
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (55 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 56/57] sparc: " Simon Glass
@ 2012-11-16 21:20 ` Simon Glass
  2012-11-20  7:25 ` [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Wolfgang Denk
  57 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-16 21:20 UTC (permalink / raw)
  To: u-boot

Move x86 over to use generic global_data.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/x86/include/asm/global_data.h |   32 +++-----------------------------
 1 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index d2eb00a..f0875f8 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -40,35 +40,11 @@ struct arch_global_data {
 	unsigned long gdt_addr;		/* Location of GDT */
 };
 
-/*
- * The following data structure is placed in some memory wich is
- * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
- * some locked parts of the data cache) to allow for a minimum set of
- * global variables during system initialization (until we have set
- * up the memory controller so that we can use RAM).
- */
-
-typedef	struct global_data {
-	bd_t		*bd;
-	unsigned long	flags;
-	unsigned int	baudrate;
-	unsigned long	have_console;	/* serial_init() was called */
-#ifdef CONFIG_PRE_CONSOLE_BUFFER
-	unsigned long	precon_buf_idx;	/* Pre-Console buffer index */
 #endif
-	unsigned long	reloc_off;	/* Relocation Offset */
-	unsigned long	env_addr;	/* Address  of Environment struct */
-	unsigned long	env_valid;	/* Checksum of Environment valid? */
-	unsigned long	cpu_clk;	/* CPU clock in Hz!		*/
-	unsigned long	bus_clk;
-	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
-	unsigned long	start_addr_sp;	/* start_addr_stackpointer */
-	phys_size_t	ram_size;	/* RAM size */
-	void		**jt;		/* jump table */
-	char		env_buf[32];	/* buffer for getenv() before reloc. */
-	struct arch_global_data arch;	/* architecture-specific data */
-} gd_t;
 
+#include <asm-generic/global_data.h>
+
+#ifndef __ASSEMBLY__
 static inline gd_t *get_fs_gd_ptr(void)
 {
 	gd_t *gd_ptr;
@@ -82,8 +58,6 @@ static inline gd_t *get_fs_gd_ptr(void)
 
 #endif
 
-#include <asm-generic/global_data_flags.h>
-
 #define DECLARE_GLOBAL_DATA_PTR
 
 #endif /* __ASM_GBL_DATA_H */
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 08/57] ixp: Move timestamp to arch_global_data
  2012-11-16 21:19 ` [U-Boot] [PATCH 08/57] ixp: Move timestamp " Simon Glass
@ 2012-11-16 22:22   ` Marek Vasut
  0 siblings, 0 replies; 78+ messages in thread
From: Marek Vasut @ 2012-11-16 22:22 UTC (permalink / raw)
  To: u-boot

Dear Simon Glass,

> Move this field into arch_global_data and tidy up.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Ick, this driver's ugly :)

Acked-by: Marek Vasut <marex@denx.de>

Tom, is there any IXP maintainer?

> ---
>  arch/arm/cpu/ixp/timer.c           |    8 ++++----
>  arch/arm/include/asm/global_data.h |    6 +++---
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/cpu/ixp/timer.c b/arch/arm/cpu/ixp/timer.c
> index 0450b51..663d989 100644
> --- a/arch/arm/cpu/ixp/timer.c
> +++ b/arch/arm/cpu/ixp/timer.c
> @@ -70,14 +70,14 @@ unsigned long long get_ticks(void)
> 
>  	if (readl(IXP425_OSST) & IXP425_OSST_TIMER_TS_PEND) {
>  		/* rollover of timestamp timer register */
> -		gd->timestamp += (0xFFFFFFFF - gd->arch.lastinc) + now + 1;
> +		gd->arch.timestamp += (0xFFFFFFFF - gd->arch.lastinc) + now + 1;
>  		writel(IXP425_OSST_TIMER_TS_PEND, IXP425_OSST);
>  	} else {
>  		/* move stamp forward with absolut diff ticks */
> -		gd->timestamp += (now - gd->arch.lastinc);
> +		gd->arch.timestamp += (now - gd->arch.lastinc);
>  	}
>  	gd->arch.lastinc = now;
> -	return gd->timestamp;
> +	return gd->arch.timestamp;
>  }
> 
> 
> @@ -86,7 +86,7 @@ void reset_timer_masked(void)
>  	/* capture current timestamp counter */
>  	gd->arch.lastinc = readl(IXP425_OSTS_B);
>  	/* start "advancing" time stamp from 0 */
> -	gd->timestamp = 0;
> +	gd->arch.timestamp = 0;
>  }
> 
>  ulong get_timer_masked(void)
> diff --git a/arch/arm/include/asm/global_data.h
> b/arch/arm/include/asm/global_data.h index 95e23e1..35d07d0 100644
> --- a/arch/arm/include/asm/global_data.h
> +++ b/arch/arm/include/asm/global_data.h
> @@ -41,6 +41,9 @@ struct arch_global_data {
>  	unsigned long tbl;
>  	unsigned long lastinc;
>  	unsigned long long timer_reset_value;
> +#ifdef CONFIG_IXP425
> +	unsigned long timestamp;
> +#endif
>  };
> 
>  /*
> @@ -65,9 +68,6 @@ typedef	struct	global_data {
>  #ifdef CONFIG_FSL_ESDHC
>  	unsigned long	sdhc_clk;
>  #endif
> -#ifdef CONFIG_IXP425
> -	unsigned long	timestamp;
> -#endif
>  	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
>  	phys_size_t	ram_size;	/* RAM size */
>  	unsigned long	mon_len;	/* monitor len */

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 13/57] x86: Move new_gd_addr to arch_global_data
  2012-11-16 21:19 ` [U-Boot] [PATCH 13/57] x86: Move new_gd_addr to arch_global_data Simon Glass
@ 2012-11-18  1:07   ` Graeme Russ
  2012-12-14  6:34     ` Simon Glass
  0 siblings, 1 reply; 78+ messages in thread
From: Graeme Russ @ 2012-11-18  1:07 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 11/17/2012 08:19 AM, Simon Glass wrote:
> Move this field into arch_global_data and tidy up.
> 
> This will certainly break x86, so will need Graeme's help to sort out

Yes, it most certainly will break x86 :)

> the problem. I would prefer not to put the architecture-specific stuff
> at the top of global_data since we relying on that seems even more ugly.

The fix is not that hard though...

The whole point of putting gdt_addr at the top of the global data structure
is to guarantee that is is the very fist void * in gd. The trick is how we
use the 'F' segment. By loading the fs register with the physical address
of gd, virtual address 0 of fs contains the address of gd.

But really, we can put the address of gd anywhere, as long as we set fs to
be that address

> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>  arch/x86/cpu/cpu.c                 |    2 +-
>  arch/x86/include/asm/global_data.h |   12 +++++++++---
>  arch/x86/lib/init_helpers.c        |    2 +-
>  3 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
> index e9bb0d7..c276aa6 100644
> --- a/arch/x86/cpu/cpu.c
> +++ b/arch/x86/cpu/cpu.c
> @@ -92,7 +92,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
>  
>  void init_gd(gd_t *id, u64 *gdt_addr)
>  {
> -	id->gd_addr = (ulong)id;
> +	id->arch.gd_addr = (ulong)id;
>  	setup_gdt(id, gdt_addr);

If the original code had been:

setup_gdt(&(id->gd_addr), gdt_addr);

There would have been no reliance on gd_addr being the first member of gd.
So change this to:

setup_gdt(&(id->arch.gd_addr), gdt_addr);

And you should be pretty much set - and gd_addr can be anywhere in the arch gd.

>  }
>  
> diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
> index 3df83bb..d2eb00a 100644
> --- a/arch/x86/include/asm/global_data.h
> +++ b/arch/x86/include/asm/global_data.h
> @@ -28,8 +28,16 @@
>  
>  /* Architecture-specific global data */
>  struct arch_global_data {
> -	unsigned long gdt_addr;		/* Location of GDT */
> +	/*
> +	 * NOTE: gd_addr MUST be first member of struct global_data!
> +	 *
> +	 * But it now isn't, so this is sure to break x86. Can we change
> +	 * x86 to not require this? I don't think we should put the
> +	 * arch data first in global_data...
> +	 */

Yes we can - see above

>  	unsigned long new_gd_addr;	/* New location of Global Data */
> +	unsigned long gd_addr;		/* Location of Global Data */
> +	unsigned long gdt_addr;		/* Location of GDT */
>  };
>  
>  /*
> @@ -41,8 +49,6 @@ struct arch_global_data {
>   */
>  
>  typedef	struct global_data {
> -	/* NOTE: gd_addr MUST be first member of struct global_data! */
> -	unsigned long	gd_addr;	/* Location of Global Data */
>  	bd_t		*bd;
>  	unsigned long	flags;
>  	unsigned int	baudrate;
> diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
> index 05cadcd..ac789c2 100644
> --- a/arch/x86/lib/init_helpers.c
> +++ b/arch/x86/lib/init_helpers.c
> @@ -126,7 +126,7 @@ int copy_gd_to_ram_f_r(void)
>  	 * in-RAM copy of Global Data (calculate_relocation_address()
>  	 * has already calculated the in-RAM location of the GDT)
>  	 */
> -	ram_gd->gd_addr = (ulong)ram_gd;
> +	ram_gd->arch.gd_addr = (ulong)ram_gd;
>  	init_gd(ram_gd, (u64 *)gd->arch.gdt_addr);
>  
>  	return 0;
> 

Regards,

Graeme

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 51/57] nios2: Use generic global_data
  2012-11-16 21:20 ` [U-Boot] [PATCH 51/57] nios2: " Simon Glass
@ 2012-11-20  4:01   ` Thomas Chou
  0 siblings, 0 replies; 78+ messages in thread
From: Thomas Chou @ 2012-11-20  4:01 UTC (permalink / raw)
  To: u-boot

On 11/17/2012 05:20 AM, Simon Glass wrote:
> Move nios2 over to use generic global_data.

Hi Simon,

Built and tested on nios2 board.

Acked-by: Thomas Chou <thomas@wytron.com.tw>

- Thomas

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
                   ` (56 preceding siblings ...)
  2012-11-16 21:20 ` [U-Boot] [PATCH 57/57] x86: " Simon Glass
@ 2012-11-20  7:25 ` Wolfgang Denk
  2012-11-20 14:06   ` Simon Glass
  57 siblings, 1 reply; 78+ messages in thread
From: Wolfgang Denk @ 2012-11-20  7:25 UTC (permalink / raw)
  To: u-boot

Dear Simon Glass,

In message <1353100842-20126-1-git-send-email-sjg@chromium.org> you wrote:
> The previous generic board series hit a snag in that we needed generic
> code to access some of the architecture-specific fields in global_data.

I missed that.  Can you please summarize what exactly the problem was,
and how this modification is supposed to fix it?

> The solution eventually arrived at was to move these fields into a
> separate structure, so that global_data has the generic fields,
> and within that there is an arch_global_data structure holding the
> architecture-specific ones.
> 
> This series makes that change. Assuming this is reasonable, the next
> step is to bring back the generic board patches on top of this.

This cover letter has a RFC in the subject,. but the following patch
series does not.  This is actually bad!

General comments / questions:

- We always attempted to keep global data as small as possible.  What
  happens here appears to be a move in a totally wrong direction.
  Instead of simplyfiyng it (and moving stuff out of global data), we
  add more and more complexity to it.  That's wrong.  We should not
  do that.

- The change makes the code less readable.  Reading "gd->arch."
  instead of plain "gd->" is no improvements, but rather vice versa.
  If we really go this way, this should be improved.

- What exactly is the impact of this code changes on the memory
  footprint?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I'm what passes for a Unix guru in my office. This is  a  frightening
concept. - Lee Ann Goldstein, in <3k55ba$c43@butch.lmsc.lockheed.com>

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-11-20  7:25 ` [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Wolfgang Denk
@ 2012-11-20 14:06   ` Simon Glass
  2012-11-28 23:57     ` Simon Glass
                       ` (2 more replies)
  0 siblings, 3 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-20 14:06 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

On Mon, Nov 19, 2012 at 11:25 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Simon Glass,
>
> In message <1353100842-20126-1-git-send-email-sjg@chromium.org> you wrote:
>> The previous generic board series hit a snag in that we needed generic
>> code to access some of the architecture-specific fields in global_data.
>
> I missed that.  Can you please summarize what exactly the problem was,
> and how this modification is supposed to fix it?
>

The discussion at the time was here:

http://patchwork.ozlabs.org/patch/146798/

My previous effort to create a generic board init basically fell over
on this point. Do you agree with the analysis and proposal on that
thread?

>> The solution eventually arrived at was to move these fields into a
>> separate structure, so that global_data has the generic fields,
>> and within that there is an arch_global_data structure holding the
>> architecture-specific ones.
>>
>> This series makes that change. Assuming this is reasonable, the next
>> step is to bring back the generic board patches on top of this.
>
> This cover letter has a RFC in the subject,. but the following patch
> series does not.  This is actually bad!

Yes, I added the RFC late and didn't go back and change the rest. I
have marked them RFC in patchwork.

>
> General comments / questions:
>
> - We always attempted to keep global data as small as possible.  What
>   happens here appears to be a move in a totally wrong direction.
>   Instead of simplyfiyng it (and moving stuff out of global data), we
>   add more and more complexity to it.  That's wrong.  We should not
>   do that.

It creates a new generic global data which is very simple. For many
archs this is empty or very short so they will be happy.

The global data is no larger in this series, nor is it any smaller.

I hope that my moving arch-specific things into their own file it will
help people to simplify things, but if it doesn't then at least it
doesn't pollute everything else.

I think the complexity you refer to is the introduction of an
architecture-specific structure within global data, where all the
arch-specific stuff lives.

This is the solution arrived at on that thread. If this doesn't suit,
please can you suggest an alternative.

>
> - The change makes the code less readable.  Reading "gd->arch."
>   instead of plain "gd->" is no improvements, but rather vice versa.
>   If we really go this way, this should be improved.

Yes it would be nice. Are you suggesting some sort of macro, or something else?

>
> - What exactly is the impact of this code changes on the memory
>   footprint?

We are just moving structure members around a bit, not actually
changing the function of the code. The series is basically a nop from
that point of view.

Regards,
Simon

>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> I'm what passes for a Unix guru in my office. This is  a  frightening
> concept. - Lee Ann Goldstein, in <3k55ba$c43@butch.lmsc.lockheed.com>

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-11-20 14:06   ` Simon Glass
@ 2012-11-28 23:57     ` Simon Glass
  2012-12-03 14:54     ` Tom Rini
  2012-12-04 19:17     ` Wolfgang Denk
  2 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-11-28 23:57 UTC (permalink / raw)
  To: u-boot

Hi,

On Tue, Nov 20, 2012 at 6:06 AM, Simon Glass <sjg@chromium.org> wrote:
> Hi Wolfgang,
>
> On Mon, Nov 19, 2012 at 11:25 PM, Wolfgang Denk <wd@denx.de> wrote:
>> Dear Simon Glass,
>>
>> In message <1353100842-20126-1-git-send-email-sjg@chromium.org> you wrote:
>>> The previous generic board series hit a snag in that we needed generic
>>> code to access some of the architecture-specific fields in global_data.
>>
>> I missed that.  Can you please summarize what exactly the problem was,
>> and how this modification is supposed to fix it?
>>
>
> The discussion at the time was here:
>
> http://patchwork.ozlabs.org/patch/146798/
>
> My previous effort to create a generic board init basically fell over
> on this point. Do you agree with the analysis and proposal on that
> thread?

Are there any more comments on this series? A few of the patches need
an update, but I want to figure out if something else needs to be
done.

>
>>> The solution eventually arrived at was to move these fields into a
>>> separate structure, so that global_data has the generic fields,
>>> and within that there is an arch_global_data structure holding the
>>> architecture-specific ones.
>>>
>>> This series makes that change. Assuming this is reasonable, the next
>>> step is to bring back the generic board patches on top of this.
>>
>> This cover letter has a RFC in the subject,. but the following patch
>> series does not.  This is actually bad!
>
> Yes, I added the RFC late and didn't go back and change the rest. I
> have marked them RFC in patchwork.
>
>>
>> General comments / questions:
>>
>> - We always attempted to keep global data as small as possible.  What
>>   happens here appears to be a move in a totally wrong direction.
>>   Instead of simplyfiyng it (and moving stuff out of global data), we
>>   add more and more complexity to it.  That's wrong.  We should not
>>   do that.
>
> It creates a new generic global data which is very simple. For many
> archs this is empty or very short so they will be happy.
>
> The global data is no larger in this series, nor is it any smaller.
>
> I hope that my moving arch-specific things into their own file it will
> help people to simplify things, but if it doesn't then at least it
> doesn't pollute everything else.
>
> I think the complexity you refer to is the introduction of an
> architecture-specific structure within global data, where all the
> arch-specific stuff lives.
>
> This is the solution arrived at on that thread. If this doesn't suit,
> please can you suggest an alternative.
>
>>
>> - The change makes the code less readable.  Reading "gd->arch."
>>   instead of plain "gd->" is no improvements, but rather vice versa.
>>   If we really go this way, this should be improved.
>
> Yes it would be nice. Are you suggesting some sort of macro, or something else?
>
>>
>> - What exactly is the impact of this code changes on the memory
>>   footprint?
>
> We are just moving structure members around a bit, not actually
> changing the function of the code. The series is basically a nop from
> that point of view.
>
> Regards,
> Simon
>
>>
>> Best regards,
>>
>> Wolfgang Denk
>>
>> --
>> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
>> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
>> I'm what passes for a Unix guru in my office. This is  a  frightening
>> concept. - Lee Ann Goldstein, in <3k55ba$c43@butch.lmsc.lockheed.com>

Regards,
Simon

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-11-20 14:06   ` Simon Glass
  2012-11-28 23:57     ` Simon Glass
@ 2012-12-03 14:54     ` Tom Rini
  2012-12-03 22:02       ` Graeme Russ
  2012-12-04 19:20       ` Wolfgang Denk
  2012-12-04 19:17     ` Wolfgang Denk
  2 siblings, 2 replies; 78+ messages in thread
From: Tom Rini @ 2012-12-03 14:54 UTC (permalink / raw)
  To: u-boot

On Tue, Nov 20, 2012 at 06:06:30AM -0800, Simon Glass wrote:
> Hi Wolfgang,
> 
> On Mon, Nov 19, 2012 at 11:25 PM, Wolfgang Denk <wd@denx.de> wrote:
> > Dear Simon Glass,
> >
> > In message <1353100842-20126-1-git-send-email-sjg@chromium.org> you wrote:
> >> The previous generic board series hit a snag in that we needed generic
> >> code to access some of the architecture-specific fields in global_data.
[snip]
> > - The change makes the code less readable.  Reading "gd->arch."
> >   instead of plain "gd->" is no improvements, but rather vice versa.
> >   If we really go this way, this should be improved.
> 
> Yes it would be nice. Are you suggesting some sort of macro, or
> something else?

Wolfgang?  "global data, architecture specific goo, ..." reads fine and
helpful to me, honestly.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121203/8c1e4c58/attachment.pgp>

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-03 14:54     ` Tom Rini
@ 2012-12-03 22:02       ` Graeme Russ
  2012-12-03 22:19         ` Simon Glass
  2012-12-04 19:05         ` Wolfgang Denk
  2012-12-04 19:20       ` Wolfgang Denk
  1 sibling, 2 replies; 78+ messages in thread
From: Graeme Russ @ 2012-12-03 22:02 UTC (permalink / raw)
  To: u-boot

Hi Tom, Simon, Wolfgang,

On Tue, Dec 4, 2012 at 1:54 AM, Tom Rini <trini@ti.com> wrote:
> On Tue, Nov 20, 2012 at 06:06:30AM -0800, Simon Glass wrote:
>> Hi Wolfgang,
>>
>> On Mon, Nov 19, 2012 at 11:25 PM, Wolfgang Denk <wd@denx.de> wrote:
>> > Dear Simon Glass,
>> >
>> > In message <1353100842-20126-1-git-send-email-sjg@chromium.org> you wrote:
>> >> The previous generic board series hit a snag in that we needed generic
>> >> code to access some of the architecture-specific fields in global_data.
> [snip]
>> > - The change makes the code less readable.  Reading "gd->arch."
>> >   instead of plain "gd->" is no improvements, but rather vice versa.
>> >   If we really go this way, this should be improved.
>>
>> Yes it would be nice. Are you suggesting some sort of macro, or
>> something else?
>
> Wolfgang?  "global data, architecture specific goo, ..." reads fine and
> helpful to me, honestly.

I've mentioned this before - I think gd is being abused. To me, gd
should contain only data members that are explicitly required prior to
SDRAM being initialised and BSS being available. It has become a bit
of a 'well I need this variable everywhere, I'll dump it in gd'.

To be honest, I think gd should only be a temporary structure used to
carry specific data through the initialisation process up to the point
BSS becomes available. With the 'early malloc' patches in the
pipeline, it might even be possible to malloc the gd structure early
and then when BSS is available, copy the data into the final global
data structure in BSS. I think that would be complicated by functions
that need to use gd both before and after BSS becomes available.

Regards,

Graeme

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-03 22:02       ` Graeme Russ
@ 2012-12-03 22:19         ` Simon Glass
  2012-12-03 23:39           ` Tom Rini
  2012-12-04 19:25           ` Wolfgang Denk
  2012-12-04 19:05         ` Wolfgang Denk
  1 sibling, 2 replies; 78+ messages in thread
From: Simon Glass @ 2012-12-03 22:19 UTC (permalink / raw)
  To: u-boot

Hi Graeme,

On Mon, Dec 3, 2012 at 2:02 PM, Graeme Russ <graeme.russ@gmail.com> wrote:
> Hi Tom, Simon, Wolfgang,
>
> On Tue, Dec 4, 2012 at 1:54 AM, Tom Rini <trini@ti.com> wrote:
>> On Tue, Nov 20, 2012 at 06:06:30AM -0800, Simon Glass wrote:
>>> Hi Wolfgang,
>>>
>>> On Mon, Nov 19, 2012 at 11:25 PM, Wolfgang Denk <wd@denx.de> wrote:
>>> > Dear Simon Glass,
>>> >
>>> > In message <1353100842-20126-1-git-send-email-sjg@chromium.org> you wrote:
>>> >> The previous generic board series hit a snag in that we needed generic
>>> >> code to access some of the architecture-specific fields in global_data.
>> [snip]
>>> > - The change makes the code less readable.  Reading "gd->arch."
>>> >   instead of plain "gd->" is no improvements, but rather vice versa.
>>> >   If we really go this way, this should be improved.
>>>
>>> Yes it would be nice. Are you suggesting some sort of macro, or
>>> something else?
>>
>> Wolfgang?  "global data, architecture specific goo, ..." reads fine and
>> helpful to me, honestly.
>
> I've mentioned this before - I think gd is being abused. To me, gd
> should contain only data members that are explicitly required prior to
> SDRAM being initialised and BSS being available. It has become a bit
> of a 'well I need this variable everywhere, I'll dump it in gd'.
>
> To be honest, I think gd should only be a temporary structure used to
> carry specific data through the initialisation process up to the point
> BSS becomes available. With the 'early malloc' patches in the
> pipeline, it might even be possible to malloc the gd structure early
> and then when BSS is available, copy the data into the final global
> data structure in BSS. I think that would be complicated by functions
> that need to use gd both before and after BSS becomes available.

I mostly agree, but that sounds like an exercise in removing fields
from the gd one by one in the source code. The bit I am not sure of is
whether it is useful for gd to hang around post relocation to provide
access to the data that was decided on early in boot (after all, the
position in memory of gd changes post relocation, so why maintain two
structures for the same info?).

>
> Regards,
>
> Graeme

Regards,
Simon

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-03 22:19         ` Simon Glass
@ 2012-12-03 23:39           ` Tom Rini
  2012-12-03 23:45             ` Graeme Russ
  2012-12-04 19:25           ` Wolfgang Denk
  1 sibling, 1 reply; 78+ messages in thread
From: Tom Rini @ 2012-12-03 23:39 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/03/12 17:19, Simon Glass wrote:
> Hi Graeme,
> 
> On Mon, Dec 3, 2012 at 2:02 PM, Graeme Russ <graeme.russ@gmail.com>
> wrote:
>> Hi Tom, Simon, Wolfgang,
>> 
>> On Tue, Dec 4, 2012 at 1:54 AM, Tom Rini <trini@ti.com> wrote:
>>> On Tue, Nov 20, 2012 at 06:06:30AM -0800, Simon Glass wrote:
>>>> Hi Wolfgang,
>>>> 
>>>> On Mon, Nov 19, 2012 at 11:25 PM, Wolfgang Denk <wd@denx.de>
>>>> wrote:
>>>>> Dear Simon Glass,
>>>>> 
>>>>> In message
>>>>> <1353100842-20126-1-git-send-email-sjg@chromium.org> you
>>>>> wrote:
>>>>>> The previous generic board series hit a snag in that we
>>>>>> needed generic code to access some of the
>>>>>> architecture-specific fields in global_data.
>>> [snip]
>>>>> - The change makes the code less readable.  Reading
>>>>> "gd->arch." instead of plain "gd->" is no improvements, but
>>>>> rather vice versa. If we really go this way, this should be
>>>>> improved.
>>>> 
>>>> Yes it would be nice. Are you suggesting some sort of macro,
>>>> or something else?
>>> 
>>> Wolfgang?  "global data, architecture specific goo, ..." reads
>>> fine and helpful to me, honestly.
>> 
>> I've mentioned this before - I think gd is being abused. To me,
>> gd should contain only data members that are explicitly required
>> prior to SDRAM being initialised and BSS being available. It has
>> become a bit of a 'well I need this variable everywhere, I'll
>> dump it in gd'.
>> 
>> To be honest, I think gd should only be a temporary structure
>> used to carry specific data through the initialisation process up
>> to the point, BSS becomes available. With the 'early malloc'
>> patches in the pipeline, it might even be possible to malloc the
>> gd structure early and then when BSS is available, copy the data
>> into the final global data structure in BSS. I think that would
>> be complicated by functions that need to use gd both before and
>> after BSS becomes available.
> 
> I mostly agree, but that sounds like an exercise in removing
> fields from the gd one by one in the source code. The bit I am not
> sure of is whether it is useful for gd to hang around post
> relocation to provide access to the data that was decided on early
> in boot (after all, the position in memory of gd changes post
> relocation, so why maintain two structures for the same info?).

At the high level, yes, such a cleaning of gd and perhaps even a
re-evaluation of what kind of "global data" structure we need to keep
around for the whole run time is warranted.  And the gd->arch->foo
would be a good place to start looking for shouldn't be in gd at all
candidates.  But that's not a blocker, to me, for this series, since
it will help show the problems.

- -- 
Tom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQvThOAAoJENk4IS6UOR1WWowQALLMLDuRC+YnfTDy0AMPhMCo
iasdqmyQRBBKXU/3o3D6EbOiiYxmmwrWEElJ6E1L3MiJknHz+P0vXJ0ec3DOo1BR
2B7hTMZewiDPGnJ7oREQAFXL2pW1hWKkYPwy/EQwz7RLncKM5+lAfwyuc4c2BFSH
oRYEKglQYCj/VO0H85vuS6BrBKrhdUOzq0AHebaxUnxPX0ZsBCqDesYjxViWVKZy
5Hw3ukqQYFTjl4P3/Ss9IcPkctbp/LWtRpq+vCNLuNee6UHuICz0Ws5wRySsoMpw
AE14EfVXn+N0QsMzm5fWQtCoXDe2J0+UD5qUXnMBUjf3VvlA0OnosHkYl/jOeuu0
oumHcf/YfHvoJpGDuwf2potshB5dlhzLRi4p86Gm/EPpL53zeqKvNJZJEmH70JPd
tKGEMN3RKwPUKzjM8TmaNlGl4HOlxnG4u3qe0DQsAB4rz39z86J/GS0xPzXcuDXO
MFOx+R6bpDtHk6I8YoqiERAReS20ppVi6ktMOUYpysdJjlyIqQ9qUvZChdm7Xx/J
7H7KW3W12z09k+IbexX4Bmv/2m+HNeeN1NgiD10erzFrLxeXZgxSoJ7P+II07aOm
tv483hTErPR0kPS4/oHrfxg1SGEQfCP9c9020RFspVl8ZcoRIuPam8H1RO+Hlzxl
Jhw9kwC54Dlcrthbk9/F
=3MpI
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-03 23:39           ` Tom Rini
@ 2012-12-03 23:45             ` Graeme Russ
  2012-12-04 19:27               ` Wolfgang Denk
  0 siblings, 1 reply; 78+ messages in thread
From: Graeme Russ @ 2012-12-03 23:45 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On Tue, Dec 4, 2012 at 10:39 AM, Tom Rini <trini@ti.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 12/03/12 17:19, Simon Glass wrote:
>> Hi Graeme,
>>
>> On Mon, Dec 3, 2012 at 2:02 PM, Graeme Russ <graeme.russ@gmail.com>
>> wrote:
>>> Hi Tom, Simon, Wolfgang,
>>>
>>> On Tue, Dec 4, 2012 at 1:54 AM, Tom Rini <trini@ti.com> wrote:
>>>> On Tue, Nov 20, 2012 at 06:06:30AM -0800, Simon Glass wrote:
>>>>> Hi Wolfgang,
>>>>>
>>>>> On Mon, Nov 19, 2012 at 11:25 PM, Wolfgang Denk <wd@denx.de>
>>>>> wrote:
>>>>>> Dear Simon Glass,
>>>>>>
>>>>>> In message
>>>>>> <1353100842-20126-1-git-send-email-sjg@chromium.org> you
>>>>>> wrote:
>>>>>>> The previous generic board series hit a snag in that we
>>>>>>> needed generic code to access some of the
>>>>>>> architecture-specific fields in global_data.
>>>> [snip]
>>>>>> - The change makes the code less readable.  Reading
>>>>>> "gd->arch." instead of plain "gd->" is no improvements, but
>>>>>> rather vice versa. If we really go this way, this should be
>>>>>> improved.
>>>>>
>>>>> Yes it would be nice. Are you suggesting some sort of macro,
>>>>> or something else?
>>>>
>>>> Wolfgang?  "global data, architecture specific goo, ..." reads
>>>> fine and helpful to me, honestly.
>>>
>>> I've mentioned this before - I think gd is being abused. To me,
>>> gd should contain only data members that are explicitly required
>>> prior to SDRAM being initialised and BSS being available. It has
>>> become a bit of a 'well I need this variable everywhere, I'll
>>> dump it in gd'.
>>>
>>> To be honest, I think gd should only be a temporary structure
>>> used to carry specific data through the initialisation process up
>>> to the point, BSS becomes available. With the 'early malloc'
>>> patches in the pipeline, it might even be possible to malloc the
>>> gd structure early and then when BSS is available, copy the data
>>> into the final global data structure in BSS. I think that would
>>> be complicated by functions that need to use gd both before and
>>> after BSS becomes available.
>>
>> I mostly agree, but that sounds like an exercise in removing
>> fields from the gd one by one in the source code. The bit I am not
>> sure of is whether it is useful for gd to hang around post
>> relocation to provide access to the data that was decided on early
>> in boot (after all, the position in memory of gd changes post
>> relocation, so why maintain two structures for the same info?).
>
> At the high level, yes, such a cleaning of gd and perhaps even a
> re-evaluation of what kind of "global data" structure we need to keep
> around for the whole run time is warranted.  And the gd->arch->foo
> would be a good place to start looking for shouldn't be in gd at all
> candidates.  But that's not a blocker, to me, for this series, since
> it will help show the problems.

I agree. While gd->arch does look a bit 'ugly', it immediately unlocks
the path forward to unifying the init loop. The x86 board.c would be a
good start (IMNSHO) by simply making the init sequence arrays extern.

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-03 22:02       ` Graeme Russ
  2012-12-03 22:19         ` Simon Glass
@ 2012-12-04 19:05         ` Wolfgang Denk
  1 sibling, 0 replies; 78+ messages in thread
From: Wolfgang Denk @ 2012-12-04 19:05 UTC (permalink / raw)
  To: u-boot

Dear Graeme Russ,

In message <CALButCKtUBx1+prpcLC-YRFc7GV6Dgq_TFx-QwH4WXCvnST=Ow@mail.gmail.com> you wrote:
> 
> I've mentioned this before - I think gd is being abused. To me, gd
> should contain only data members that are explicitly required prior to
> SDRAM being initialised and BSS being available. It has become a bit
> of a 'well I need this variable everywhere, I'll dump it in gd'.

All too true!!

> To be honest, I think gd should only be a temporary structure used to
> carry specific data through the initialisation process up to the point
> BSS becomes available. With the 'early malloc' patches in the
> pipeline, it might even be possible to malloc the gd structure early
> and then when BSS is available, copy the data into the final global
> data structure in BSS. I think that would be complicated by functions
> that need to use gd both before and after BSS becomes available.

If we could drop gd after relocation, I'd be all too happy.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Success in marriage is not so much finding the right person as it  is
being the right person.

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-11-20 14:06   ` Simon Glass
  2012-11-28 23:57     ` Simon Glass
  2012-12-03 14:54     ` Tom Rini
@ 2012-12-04 19:17     ` Wolfgang Denk
  2 siblings, 0 replies; 78+ messages in thread
From: Wolfgang Denk @ 2012-12-04 19:17 UTC (permalink / raw)
  To: u-boot

Dear Simon,

In message <CAPnjgZ3QMB+0vcamWAkxF1vvBwzgijAXpDUtBbb7YegEz0pssw@mail.gmail.com> you wrote:
> 
> The discussion at the time was here:
> 
> http://patchwork.ozlabs.org/patch/146798/
> 
> My previous effort to create a generic board init basically fell over
> on this point. Do you agree with the analysis and proposal on that
> thread?

Mostly; but some questions have never been really answered, for
example the effect on the memory footprint (i.e. code size).

> > General comments / questions:
> >
> > - We always attempted to keep global data as small as possible.  What
> >   happens here appears to be a move in a totally wrong direction.
> >   Instead of simplyfiyng it (and moving stuff out of global data), we
> >   add more and more complexity to it.  That's wrong.  We should not
> >   do that.
> 
> It creates a new generic global data which is very simple. For many
> archs this is empty or very short so they will be happy.
> 
> The global data is no larger in this series, nor is it any smaller.

See Graemes other comment...

> I hope that my moving arch-specific things into their own file it will
> help people to simplify things, but if it doesn't then at least it
> doesn't pollute everything else.
> 
> I think the complexity you refer to is the introduction of an
> architecture-specific structure within global data, where all the
> arch-specific stuff lives.
> 
> This is the solution arrived at on that thread. If this doesn't suit,
> please can you suggest an alternative.

I already did above, and basicly this is what Graeme asks for, too:
instead of adding stuff to GD, we should reduce it to the really
needed bare minimum.  I'm not sure hoch much architecture specific
data would survive such a cleanup.

> > - The change makes the code less readable.  Reading "gd->arch."
> >   instead of plain "gd->" is no improvements, but rather vice versa.
> >   If we really go this way, this should be improved.
> 
> Yes it would be nice. Are you suggesting some sort of macro, or something else?

I don;t like the additional level of nesting, nomatter if I have to
write it outt or if it's hidden in some macro (actually I fear tyhe
macro version would be even worse to understand).

> > - What exactly is the impact of this code changes on the memory
> >   footprint?
> 
> We are just moving structure members around a bit, not actually
> changing the function of the code. The series is basically a nop from
> that point of view.

You add a level of indirecting to the code.  I doubt that goues
without code to load some registers (which in turn will add other code
to push and pop needed registers to/from the stack).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"To IBM, 'open' means there is a modicum  of  interoperability  among
some of their equipment."                            - Harv Masterson

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-03 14:54     ` Tom Rini
  2012-12-03 22:02       ` Graeme Russ
@ 2012-12-04 19:20       ` Wolfgang Denk
  1 sibling, 0 replies; 78+ messages in thread
From: Wolfgang Denk @ 2012-12-04 19:20 UTC (permalink / raw)
  To: u-boot

Dear Tom,

In message <20121203145414.GE15777@bill-the-cat> you wrote:
> 
> > > - The change makes the code less readable.  Reading "gd->arch."
> > >   instead of plain "gd->" is no improvements, but rather vice versa.
> > >   If we really go this way, this should be improved.
> > 
> > Yes it would be nice. Are you suggesting some sort of macro, or
> > something else?
>
> Wolfgang?  "global data, architecture specific goo, ..." reads fine and
> helpful to me, honestly.

Well, maybe, at first glance. But when you read (and write) it again
and again and again it quickly becomes a PITA.  It's similar to a
nested pull-down menu - when you use it the first time, it's nice that
you don't have to remember the exact command name and/or options to
perform operation foo - but when you find yourself doing this many
times a day, you will highly prefer to type a short command on the
command line over having to pull down three or four nested levels in
some pull-down menu.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
As a general rule, the freedom of any people can  be  judged  by  the
volume of their laughter.

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-03 22:19         ` Simon Glass
  2012-12-03 23:39           ` Tom Rini
@ 2012-12-04 19:25           ` Wolfgang Denk
  2012-12-05  1:14             ` Graeme Russ
  1 sibling, 1 reply; 78+ messages in thread
From: Wolfgang Denk @ 2012-12-04 19:25 UTC (permalink / raw)
  To: u-boot

Dear Simon Glass,

In message <CAPnjgZ2KVHV6JCvOjiQBrXFCfHMeWfEfj9bLHFw_Qyf5_7dj8Q@mail.gmail.com> you wrote:
> 
> > To be honest, I think gd should only be a temporary structure used to
> > carry specific data through the initialisation process up to the point
> > BSS becomes available. With the 'early malloc' patches in the
> > pipeline, it might even be possible to malloc the gd structure early
> > and then when BSS is available, copy the data into the final global
> > data structure in BSS. I think that would be complicated by functions
> > that need to use gd both before and after BSS becomes available.
> 
> I mostly agree, but that sounds like an exercise in removing fields
> from the gd one by one in the source code. The bit I am not sure of is
> whether it is useful for gd to hang around post relocation to provide
> access to the data that was decided on early in boot (after all, the
> position in memory of gd changes post relocation, so why maintain two
> structures for the same info?).

Sure.  If you look back how this developed, then initially there was
only struct bd_info.  Then it turned out that it costs too much of
code size (and performance, actually) to pass around the same struct
as parameter to about each and every functiuon, so I invented GD - wit
the intention to drop it as soon as writable global data becomes
available, i. e. after relocation.  I even think the first versions
worked that way.  Only later that code code optimized because it
seemed easier to keep this struct and be able to use the same code
before and after relocation.  And open Pandora's box was...


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In an organization, each person rises to the level of his own  incom-
petency                                         - The Peter Principle

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-03 23:45             ` Graeme Russ
@ 2012-12-04 19:27               ` Wolfgang Denk
  2012-12-05  0:02                 ` Simon Glass
  0 siblings, 1 reply; 78+ messages in thread
From: Wolfgang Denk @ 2012-12-04 19:27 UTC (permalink / raw)
  To: u-boot

Dear Graeme Russ,

In message <CALButCJqp4CPvpwc_ri9fp6tcd=Az-7Si=FMMc0adWBHMDtVQw@mail.gmail.com> you wrote:
> 
> I agree. While gd->arch does look a bit 'ugly', it immediately unlocks
> the path forward to unifying the init loop. The x86 board.c would be a
> good start (IMNSHO) by simply making the init sequence arrays extern.
> From there we can tackle what really needs to be in gd and what can
> simply be run of the mill global variables. I think most of what is
> under gd->arch may just 'fall out'

OK, it seems I have the weekest arguments.  I will not fight about
that.

But I would definitely like to know exactly how much we pay for in
terms of code size.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Program maintenance is an entropy-increasing process,  and  even  its
most skilfull execution only delays the subsidence of the system into
unfixable obsolescence.       - Fred Brooks, "The Mythical Man Month"

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-04 19:27               ` Wolfgang Denk
@ 2012-12-05  0:02                 ` Simon Glass
  0 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-12-05  0:02 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

On Tue, Dec 4, 2012 at 11:27 AM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Graeme Russ,
>
> In message <CALButCJqp4CPvpwc_ri9fp6tcd=Az-7Si=FMMc0adWBHMDtVQw@mail.gmail.com> you wrote:
>>
>> I agree. While gd->arch does look a bit 'ugly', it immediately unlocks
>> the path forward to unifying the init loop. The x86 board.c would be a
>> good start (IMNSHO) by simply making the init sequence arrays extern.
>> From there we can tackle what really needs to be in gd and what can
>> simply be run of the mill global variables. I think most of what is
>> under gd->arch may just 'fall out'
>
> OK, it seems I have the weekest arguments.  I will not fight about
> that.
>
> But I would definitely like to know exactly how much we pay for in
> terms of code size.

I will measure this and report in a day or two (have sneaked out of the office).

Regards,
Simon

>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> Program maintenance is an entropy-increasing process,  and  even  its
> most skilfull execution only delays the subsidence of the system into
> unfixable obsolescence.       - Fred Brooks, "The Mythical Man Month"

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-04 19:25           ` Wolfgang Denk
@ 2012-12-05  1:14             ` Graeme Russ
  2012-12-06  0:33               ` Simon Glass
  0 siblings, 1 reply; 78+ messages in thread
From: Graeme Russ @ 2012-12-05  1:14 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

On Wed, Dec 5, 2012 at 6:25 AM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Simon Glass,
>
> In message <CAPnjgZ2KVHV6JCvOjiQBrXFCfHMeWfEfj9bLHFw_Qyf5_7dj8Q@mail.gmail.com> you wrote:
>>
>> > To be honest, I think gd should only be a temporary structure used to
>> > carry specific data through the initialisation process up to the point
>> > BSS becomes available. With the 'early malloc' patches in the
>> > pipeline, it might even be possible to malloc the gd structure early
>> > and then when BSS is available, copy the data into the final global
>> > data structure in BSS. I think that would be complicated by functions
>> > that need to use gd both before and after BSS becomes available.
>>
>> I mostly agree, but that sounds like an exercise in removing fields
>> from the gd one by one in the source code. The bit I am not sure of is
>> whether it is useful for gd to hang around post relocation to provide
>> access to the data that was decided on early in boot (after all, the
>> position in memory of gd changes post relocation, so why maintain two
>> structures for the same info?).
>
> Sure.  If you look back how this developed, then initially there was
> only struct bd_info.  Then it turned out that it costs too much of
> code size (and performance, actually) to pass around the same struct
> as parameter to about each and every functiuon, so I invented GD - wit
> the intention to drop it as soon as writable global data becomes
> available, i. e. after relocation.  I even think the first versions
> worked that way.  Only later that code code optimized because it
> seemed easier to keep this struct and be able to use the same code
> before and after relocation.  And open Pandora's box was...

Yes, the old 'cost versus complexity' problem. Seriously, take a look at
arch/x86/lib/board.c, it's nice and clean and give a good view of how we
can move forward.

For starters, the functions listed in init_sequence_f and init_sequence_f_r
never need to be copied into RAM (there are functions they call that may
need to be though). Like the Linux kernel, these can be moved into a
dedicated linker section and not copied (and their relocation entries can
be skipped as well). For x86, there are not a lot of functions in these
two lists. Maybe these can have 'gd' passed to them

init_sequence_r is the big list so passing 'gd' to each of these will
result in massive code bloat. But by this stage, we have BSS, so global
data is writable and there is no need to pass gd.

BSS is actually available during the processing of init_sequence_f_r,
so in theory it would be possible to copy data from gd (used during
init_sequence_f) into BSS during the processing of init_sequence_f_r

All that would be left is dealing with the (handful?) of functions that
are called from both init_sequence_f and init_sequence_r (I doubt any
common functions will be called during init_sequence_f_r). One option
may be to pass a point to gd to these functions. If it is NULL, use
the variable in BSS, otherwise use gd.

Regards,

Graeme

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure
  2012-12-05  1:14             ` Graeme Russ
@ 2012-12-06  0:33               ` Simon Glass
  0 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-12-06  0:33 UTC (permalink / raw)
  To: u-boot

Hi,

On Tue, Dec 4, 2012 at 5:14 PM, Graeme Russ <graeme.russ@gmail.com> wrote:
> Hi Wolfgang,
>
> On Wed, Dec 5, 2012 at 6:25 AM, Wolfgang Denk <wd@denx.de> wrote:
>> Dear Simon Glass,
>>
>> In message <CAPnjgZ2KVHV6JCvOjiQBrXFCfHMeWfEfj9bLHFw_Qyf5_7dj8Q@mail.gmail.com> you wrote:
>>>
>>> > To be honest, I think gd should only be a temporary structure used to
>>> > carry specific data through the initialisation process up to the point
>>> > BSS becomes available. With the 'early malloc' patches in the
>>> > pipeline, it might even be possible to malloc the gd structure early
>>> > and then when BSS is available, copy the data into the final global
>>> > data structure in BSS. I think that would be complicated by functions
>>> > that need to use gd both before and after BSS becomes available.
>>>
>>> I mostly agree, but that sounds like an exercise in removing fields
>>> from the gd one by one in the source code. The bit I am not sure of is
>>> whether it is useful for gd to hang around post relocation to provide
>>> access to the data that was decided on early in boot (after all, the
>>> position in memory of gd changes post relocation, so why maintain two
>>> structures for the same info?).
>>
>> Sure.  If you look back how this developed, then initially there was
>> only struct bd_info.  Then it turned out that it costs too much of
>> code size (and performance, actually) to pass around the same struct
>> as parameter to about each and every functiuon, so I invented GD - wit
>> the intention to drop it as soon as writable global data becomes
>> available, i. e. after relocation.  I even think the first versions
>> worked that way.  Only later that code code optimized because it
>> seemed easier to keep this struct and be able to use the same code
>> before and after relocation.  And open Pandora's box was...
>
> Yes, the old 'cost versus complexity' problem. Seriously, take a look at
> arch/x86/lib/board.c, it's nice and clean and give a good view of how we
> can move forward.
>
> For starters, the functions listed in init_sequence_f and init_sequence_f_r
> never need to be copied into RAM (there are functions they call that may
> need to be though). Like the Linux kernel, these can be moved into a
> dedicated linker section and not copied (and their relocation entries can
> be skipped as well). For x86, there are not a lot of functions in these
> two lists. Maybe these can have 'gd' passed to them
>
> init_sequence_r is the big list so passing 'gd' to each of these will
> result in massive code bloat. But by this stage, we have BSS, so global
> data is writable and there is no need to pass gd.
>
> BSS is actually available during the processing of init_sequence_f_r,
> so in theory it would be possible to copy data from gd (used during
> init_sequence_f) into BSS during the processing of init_sequence_f_r
>
> All that would be left is dealing with the (handful?) of functions that
> are called from both init_sequence_f and init_sequence_r (I doubt any
> common functions will be called during init_sequence_f_r). One option
> may be to pass a point to gd to these functions. If it is NULL, use
> the variable in BSS, otherwise use gd.

Sounds reasonable to me.

I modified buildman to summarise image sizes for each architecture.
Here are the code size results:

       x86: (3 boards)   text -26.7
   sandbox: (1 boards)   text +64.0   bss +96.0
      m68k: (50 boards)   text +1.5
   powerpc: (621 boards)   text +2.4   data +0.0
        sh: (20 boards)   text +14.4
microblaze: (1 boards)   text -24.0   bss -8.0
       arm: (283 boards)   spl/u-boot-spl:text -0.2   text -21.5
spl/u-boot-spl:data +4.8   bss +0.5
     nds32: (3 boards)   text -8.0

The numbers indicate the average number of bytes increase(+) or
decrease(-) with this series applied, for each element of the image
size. So for example, powerpc text increases by an average of 2.4
bytes, ARM text reduces by an average of 21.5 bytes. ARM spl data
increases by an average of 4.8 bytes.

To me this doesn't seem very significant and the differences are minor.

Regards,
Simon

>
> Regards,
>
> Graeme

^ permalink raw reply	[flat|nested] 78+ messages in thread

* [U-Boot] [PATCH 13/57] x86: Move new_gd_addr to arch_global_data
  2012-11-18  1:07   ` Graeme Russ
@ 2012-12-14  6:34     ` Simon Glass
  0 siblings, 0 replies; 78+ messages in thread
From: Simon Glass @ 2012-12-14  6:34 UTC (permalink / raw)
  To: u-boot

Hi Graeme,

On Sat, Nov 17, 2012 at 5:07 PM, Graeme Russ <graeme.russ@gmail.com> wrote:
> Hi Simon,
>
> On 11/17/2012 08:19 AM, Simon Glass wrote:
>> Move this field into arch_global_data and tidy up.
>>
>> This will certainly break x86, so will need Graeme's help to sort out
>
> Yes, it most certainly will break x86 :)
>
>> the problem. I would prefer not to put the architecture-specific stuff
>> at the top of global_data since we relying on that seems even more ugly.
>
> The fix is not that hard though...
>
> The whole point of putting gdt_addr at the top of the global data structure
> is to guarantee that is is the very fist void * in gd. The trick is how we
> use the 'F' segment. By loading the fs register with the physical address
> of gd, virtual address 0 of fs contains the address of gd.
>
> But really, we can put the address of gd anywhere, as long as we set fs to
> be that address
>
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>  arch/x86/cpu/cpu.c                 |    2 +-
>>  arch/x86/include/asm/global_data.h |   12 +++++++++---
>>  arch/x86/lib/init_helpers.c        |    2 +-
>>  3 files changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
>> index e9bb0d7..c276aa6 100644
>> --- a/arch/x86/cpu/cpu.c
>> +++ b/arch/x86/cpu/cpu.c
>> @@ -92,7 +92,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
>>
>>  void init_gd(gd_t *id, u64 *gdt_addr)
>>  {
>> -     id->gd_addr = (ulong)id;
>> +     id->arch.gd_addr = (ulong)id;
>>       setup_gdt(id, gdt_addr);
>
> If the original code had been:
>
> setup_gdt(&(id->gd_addr), gdt_addr);
>
> There would have been no reliance on gd_addr being the first member of gd.
> So change this to:
>
> setup_gdt(&(id->arch.gd_addr), gdt_addr);
>
> And you should be pretty much set - and gd_addr can be anywhere in the arch gd.

Thanks for that. I actually understand it now, for better or worse. It
seems to work fine. Actually your clean-up of the global_data really
has paid dividends as things are so much nicer now.

I'm going to resend the whole series rebased to master.

Regards,
Simon

>
>>  }
>>
>> diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
>> index 3df83bb..d2eb00a 100644
>> --- a/arch/x86/include/asm/global_data.h
>> +++ b/arch/x86/include/asm/global_data.h
>> @@ -28,8 +28,16 @@
>>
>>  /* Architecture-specific global data */
>>  struct arch_global_data {
>> -     unsigned long gdt_addr;         /* Location of GDT */
>> +     /*
>> +      * NOTE: gd_addr MUST be first member of struct global_data!
>> +      *
>> +      * But it now isn't, so this is sure to break x86. Can we change
>> +      * x86 to not require this? I don't think we should put the
>> +      * arch data first in global_data...
>> +      */
>
> Yes we can - see above
>
>>       unsigned long new_gd_addr;      /* New location of Global Data */
>> +     unsigned long gd_addr;          /* Location of Global Data */
>> +     unsigned long gdt_addr;         /* Location of GDT */
>>  };
>>
>>  /*
>> @@ -41,8 +49,6 @@ struct arch_global_data {
>>   */
>>
>>  typedef      struct global_data {
>> -     /* NOTE: gd_addr MUST be first member of struct global_data! */
>> -     unsigned long   gd_addr;        /* Location of Global Data */
>>       bd_t            *bd;
>>       unsigned long   flags;
>>       unsigned int    baudrate;
>> diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
>> index 05cadcd..ac789c2 100644
>> --- a/arch/x86/lib/init_helpers.c
>> +++ b/arch/x86/lib/init_helpers.c
>> @@ -126,7 +126,7 @@ int copy_gd_to_ram_f_r(void)
>>        * in-RAM copy of Global Data (calculate_relocation_address()
>>        * has already calculated the in-RAM location of the GDT)
>>        */
>> -     ram_gd->gd_addr = (ulong)ram_gd;
>> +     ram_gd->arch.gd_addr = (ulong)ram_gd;
>>       init_gd(ram_gd, (u64 *)gd->arch.gdt_addr);
>>
>>       return 0;
>>
>
> Regards,
>
> Graeme

^ permalink raw reply	[flat|nested] 78+ messages in thread

end of thread, other threads:[~2012-12-14  6:34 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 01/57] Add architecture-specific global data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 02/57] at91: Move at91 global data into arch_global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 03/57] arm: Move timer_rate_hz " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 04/57] arm: Move tbu to arch_global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 05/57] arm: Move tbl " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 06/57] arm: Move lastinc " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 07/57] arm: Move timer_reset_value " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 08/57] ixp: Move timestamp " Simon Glass
2012-11-16 22:22   ` Marek Vasut
2012-11-16 21:19 ` [U-Boot] [PATCH 09/57] nds32: Drop tlb_addr from global data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 10/57] arm: Move tlb_addr to arch_global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 11/57] x86: Move gdt_addr, new_gd_addr " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 12/57] x86: Remove reset_status, relocoff from global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 13/57] x86: Move new_gd_addr to arch_global_data Simon Glass
2012-11-18  1:07   ` Graeme Russ
2012-12-14  6:34     ` Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 14/57] ppc: Move brg_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 15/57] ppc: Remove extra pci_clk fields from global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 16/57] ppc: Move clock fields to arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 17/57] ppc: Move mpc83xx " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 18/57] ppc: Move lbc_clk and cpu " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 19/57] ppc: m68k: Move i2c1_clk, i2c2_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 20/57] ppc: Move CONFIG_QE " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 21/57] ppc: Move used_laws " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 22/57] ppc: Move used_tlb_cams " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 23/57] ppc: Move mpc5xxx clocks " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 24/57] ppc: Move mpc512x " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 25/57] ppc: Move mpc8220 " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 26/57] ppc: Move reset_status " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 27/57] ppc: Move arbiter fields " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 28/57] ppc: Move dp_alloc_base, dp_alloc_top " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 29/57] arm: Move uart_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 30/57] ppc: Move mirror_hack " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 31/57] ppc: Remove console_addr from global data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 32/57] ppc: Move fpga_state to arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 33/57] ppc: Move wdt_last " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 34/57] ppc: Move kbd_status " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 35/57] ppc: arm: Move sdhc_clk into arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 36/57] sparc: Drop kbd_status and reset_status from global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 37/57] m68k: Move CONFIG_EXTRA_CLOCK to arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 38/57] mips: Move per_clk and dev_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 39/57] avr32: Move stack_end " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 40/57] avr32: Move cpu_hz " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 41/57] sandbox: Move ram_buf " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 42/57] Add generic global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 43/57] Only use fb_base if we have a display Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 44/57] arm: Use generic global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 45/57] avr32: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 46/57] blackfin: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 47/57] m68k: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 48/57] microblaze: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 49/57] mips: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 50/57] nds32: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 51/57] nios2: " Simon Glass
2012-11-20  4:01   ` Thomas Chou
2012-11-16 21:20 ` [U-Boot] [PATCH 52/57] openrisc: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 53/57] powerpc: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 54/57] sandbox: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 55/57] sh: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 56/57] sparc: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 57/57] x86: " Simon Glass
2012-11-20  7:25 ` [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Wolfgang Denk
2012-11-20 14:06   ` Simon Glass
2012-11-28 23:57     ` Simon Glass
2012-12-03 14:54     ` Tom Rini
2012-12-03 22:02       ` Graeme Russ
2012-12-03 22:19         ` Simon Glass
2012-12-03 23:39           ` Tom Rini
2012-12-03 23:45             ` Graeme Russ
2012-12-04 19:27               ` Wolfgang Denk
2012-12-05  0:02                 ` Simon Glass
2012-12-04 19:25           ` Wolfgang Denk
2012-12-05  1:14             ` Graeme Russ
2012-12-06  0:33               ` Simon Glass
2012-12-04 19:05         ` Wolfgang Denk
2012-12-04 19:20       ` Wolfgang Denk
2012-12-04 19:17     ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.