ppc: Move CONFIG_QE to arch_global_data

Move the quantative easing fields into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
master
Simon Glass 12 years ago committed by Tom Rini
parent 609e6ec3f6
commit 45bae2e3cf
  1. 5
      arch/powerpc/cpu/mpc83xx/speed.c
  2. 4
      arch/powerpc/cpu/mpc85xx/speed.c
  3. 14
      arch/powerpc/include/asm/global_data.h
  4. 8
      drivers/qe/fdt.c
  5. 19
      drivers/qe/qe.c

@ -495,7 +495,7 @@ int get_clocks(void)
gd->arch.mem_sec_clk = mem_sec_clk; gd->arch.mem_sec_clk = mem_sec_clk;
#endif #endif
#if defined(CONFIG_QE) #if defined(CONFIG_QE)
gd->qe_clk = qe_clk; gd->arch.qe_clk = qe_clk;
gd->arch.brg_clk = brg_clk; gd->arch.brg_clk = brg_clk;
#endif #endif
#if defined(CONFIG_MPC8308) || defined(CONFIG_MPC831x) || \ #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", printf(" Coherent System Bus: %-4s MHz\n",
strmhz(buf, gd->arch.csb_clk)); strmhz(buf, gd->arch.csb_clk));
#if defined(CONFIG_QE) #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", printf(" BRG: %-4s MHz\n",
strmhz(buf, gd->arch.brg_clk)); strmhz(buf, gd->arch.brg_clk));
#endif #endif

@ -394,8 +394,8 @@ int get_clocks (void)
gd->arch.lbc_clk = sys_info.freqLocalBus; gd->arch.lbc_clk = sys_info.freqLocalBus;
#ifdef CONFIG_QE #ifdef CONFIG_QE
gd->qe_clk = sys_info.freqQE; gd->arch.qe_clk = sys_info.freqQE;
gd->arch.brg_clk = gd->qe_clk / 2; gd->arch.brg_clk = gd->arch.qe_clk / 2;
#endif #endif
/* /*
* The base clock for I2C depends on the actual SOC. Unfortunately, * The base clock for I2C depends on the actual SOC. Unfortunately,

@ -39,9 +39,6 @@ struct arch_global_data {
unsigned long scc_clk; unsigned long scc_clk;
unsigned long brg_clk; unsigned long brg_clk;
#endif #endif
#if defined(CONFIG_QE)
u32 brg_clk;
#endif
/* TODO: sjg@chromium.org: Should these be unslgned long? */ /* TODO: sjg@chromium.org: Should these be unslgned long? */
#if defined(CONFIG_MPC83xx) #if defined(CONFIG_MPC83xx)
/* There are other clocks in the MPC83XX */ /* There are other clocks in the MPC83XX */
@ -85,6 +82,12 @@ struct arch_global_data {
u32 i2c1_clk; u32 i2c1_clk;
u32 i2c2_clk; u32 i2c2_clk;
#endif #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) #if defined(CONFIG_FSL_ESDHC)
u32 sdhc_clk; u32 sdhc_clk;
#endif #endif
#if defined(CONFIG_QE)
u32 qe_clk;
uint mp_alloc_base;
uint mp_alloc_top;
#endif /* CONFIG_QE */
#if defined(CONFIG_FSL_LAW) #if defined(CONFIG_FSL_LAW)
u32 used_laws; u32 used_laws;
#endif #endif

@ -75,16 +75,16 @@ error:
void ft_qe_setup(void *blob) void ft_qe_setup(void *blob)
{ {
do_fixup_by_prop_u32(blob, "device_type", "qe", 4, 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, do_fixup_by_prop_u32(blob, "device_type", "qe", 4,
"brg-frequency", gd->arch.brg_clk, 1); "brg-frequency", gd->arch.brg_clk, 1);
do_fixup_by_compat_u32(blob, "fsl,qe", 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", 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", do_fixup_by_compat_u32(blob, "fsl,qe",
"brg-frequency", gd->arch.brg_clk, 1); "brg-frequency", gd->arch.brg_clk, 1);
do_fixup_by_compat_u32(blob, "fsl,qe-gtm", 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); fdt_fixup_qe_firmware(blob);
} }

@ -58,21 +58,22 @@ uint qe_muram_alloc(uint size, uint align)
uint savebase; uint savebase;
align_mask = align - 1; align_mask = align - 1;
savebase = gd->mp_alloc_base; savebase = gd->arch.mp_alloc_base;
if ((off = (gd->mp_alloc_base & align_mask)) != 0) off = gd->arch.mp_alloc_base & align_mask;
gd->mp_alloc_base += (align - off); if (off != 0)
gd->arch.mp_alloc_base += (align - off);
if ((off = size & align_mask) != 0) if ((off = size & align_mask) != 0)
size += (align - off); size += (align - off);
if ((gd->mp_alloc_base + size) >= gd->mp_alloc_top) { if ((gd->arch.mp_alloc_base + size) >= gd->arch.mp_alloc_top) {
gd->mp_alloc_base = savebase; gd->arch.mp_alloc_base = savebase;
printf("%s: ran out of ram.\n", __FUNCTION__); printf("%s: ran out of ram.\n", __FUNCTION__);
} }
retloc = gd->mp_alloc_base; retloc = gd->arch.mp_alloc_base;
gd->mp_alloc_base += size; gd->arch.mp_alloc_base += size;
memset((void *)&qe_immr->muram[retloc], 0, 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); out_be32(&qe_immr->iram.iready,QE_IRAM_READY);
#endif #endif
gd->mp_alloc_base = QE_DATAONLY_BASE; gd->arch.mp_alloc_base = QE_DATAONLY_BASE;
gd->mp_alloc_top = gd->mp_alloc_base + QE_DATAONLY_SIZE; gd->arch.mp_alloc_top = gd->arch.mp_alloc_base + QE_DATAONLY_SIZE;
qe_sdma_init(); qe_sdma_init();
qe_snums_init(); qe_snums_init();

Loading…
Cancel
Save