]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
86xx: Cleanup MP support
authorKumar Gala <galak@kernel.crashing.org>
Wed, 1 Apr 2009 04:02:38 +0000 (23:02 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Wed, 1 Apr 2009 20:29:44 +0000 (15:29 -0500)
* Use CONFIG_MP instead of CONFIG_NUM_CPUS to match 85xx
* Introduce determine_mp_bootpg() helper.  We'll need this to address a
  bug introduced in v2009.03 with 86xx MP booting.  We have to make sure
  to reserve the region of memory used for the MP bootpg() so other
  u-boot code doesn't use it.
* Added dummy versions of cpu_reset(), cpu_status() & cpu_release() to
  allow cmd_mp.c to build and work. In the future we should look at
  implementing all these functions. This could be common w/85xx if we
  use spin tables on 86xx.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
board/freescale/mpc8641hpcn/mpc8641hpcn.c
board/sbc8641d/sbc8641d.c
cpu/mpc86xx/Makefile
cpu/mpc86xx/cpu_init.c
cpu/mpc86xx/fdt.c
cpu/mpc86xx/mp.c
cpu/mpc86xx/mp.h [deleted file]
cpu/mpc86xx/release.S
include/asm-ppc/mp.h [new file with mode: 0644]
include/configs/MPC8641HPCN.h
include/configs/sbc8641d.h

index 1e35dfa7c46ba7d038f6a272352cb069f4ea8c9b..ef0095ab75fb391979f82c9db2e6ada94d870a23 100644 (file)
@@ -375,7 +375,7 @@ void board_reset(void)
                ;
 }
 
-#if (CONFIG_NUM_CPUS > 1)
+#ifdef CONFIG_MP
 extern void cpu_mp_lmb_reserve(struct lmb *lmb);
 
 void board_lmb_reserve(struct lmb *lmb)
index fc1f07dc0027e40e06866bb4914a14c3f9b55f8e..9f696387eb29fe82cd47605f81f40d1f86718f39 100644 (file)
@@ -414,7 +414,7 @@ void board_reset(void)
 #endif
 }
 
-#if (CONFIG_NUM_CPUS > 1)
+#ifdef CONFIG_MP
 extern void cpu_mp_lmb_reserve(struct lmb *lmb);
 
 void board_lmb_reserve(struct lmb *lmb)
index 34a97555621457c1b7556250df9ed64a26477f3e..daca79ad4f2217ec4a2775808dd83a3f1f50a0ff 100644 (file)
@@ -29,26 +29,23 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)lib$(CPU).a
 
 START  = start.o
-SOBJS  = cache.o
 
-ifneq ($(CONFIG_NUM_CPUS),1)
-COBJS-y += mp.o
-SOBJS += release.o
-endif
-COBJS-y        += traps.o
+SOBJS-y += cache.o
+SOBJS-$(CONFIG_MP) += release.o
+
 COBJS-y        += cpu.o
 COBJS-y        += cpu_init.o
-COBJS-y        += speed.o
-COBJS-y        += interrupts.o
-
-COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
-
-COBJS-$(CONFIG_MPC8641) += ddr-8641.o
 # 8610 & 8641 are identical w/regards to DDR
 COBJS-$(CONFIG_MPC8610) += ddr-8641.o
+COBJS-$(CONFIG_MPC8641) += ddr-8641.o
+COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
+COBJS-y        += interrupts.o
+COBJS-$(CONFIG_MP) += mp.o
+COBJS-y        += speed.o
+COBJS-y        += traps.o
 
-SRCS   := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
-OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+SRCS   := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
 START  := $(addprefix $(obj),$(START))
 
 all:   $(obj).depend $(START) $(LIB)
index 4f29122f4091a753a524984afbdd3a03fb973188..49528aae713a1f7bb3b20f7603af62ed7efce1bc 100644 (file)
@@ -31,7 +31,7 @@
 #include <mpc86xx.h>
 #include <asm/mmu.h>
 #include <asm/fsl_law.h>
-#include "mp.h"
+#include <asm/mp.h>
 
 void setup_bats(void);
 
index 383b06b5ae61e4bbea0a65d63a5aa0eaa211650e..a36ee30c3f0d1b8196378bb8d4af5af53b16923e 100644 (file)
@@ -9,15 +9,15 @@
 #include <common.h>
 #include <libfdt.h>
 #include <fdt_support.h>
-#include "mp.h"
+#include <asm/mp.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
-#if (CONFIG_NUM_CPUS > 1)
+#ifdef CONFIG_MP
        int off;
-       u32 bootpg;
+       u32 bootpg = determine_mp_bootpg();
 #endif
 
        do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
@@ -48,13 +48,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
                               "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
 #endif
 
-#if (CONFIG_NUM_CPUS > 1)
-       /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
-       if (gd->ram_size > 0xfffff000)
-               bootpg = 0xfff00000;
-       else
-               bootpg = gd->ram_size - (1024 * 1024);
-
+#ifdef CONFIG_MP
        /* Reserve the boot page so OSes dont use it */
        off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
        if (off < 0)
index 5014401ddc24e5614554f1b338003ad7849d5d5b..2940673c7c7bfc89ba6de040685781abe334c351 100644 (file)
@@ -4,20 +4,45 @@
 #include <ioports.h>
 #include <lmb.h>
 #include <asm/io.h>
-#include "mp.h"
+#include <asm/mp.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if (CONFIG_NUM_CPUS > 1)
-void cpu_mp_lmb_reserve(struct lmb *lmb)
+int cpu_reset(int nr)
+{
+       /* dummy function so common/cmd_mp.c will build
+        * should be implemented in the future, when cpu_release()
+        * is supported.  Be aware there may be a similiar bug
+        * as exists on MPC85xx w/its PIC having a timing window
+        * associated to resetting the core */
+       return 1;
+}
+
+int cpu_status(int nr)
 {
-       u32 bootpg;
+       /* dummy function so common/cmd_mp.c will build */
+       return 0;
+}
+
+int cpu_release(int nr, int argc, char *argv[])
+{
+       /* dummy function so common/cmd_mp.c will build
+        * should be implemented in the future */
+       return 1;
+}
 
+u32 determine_mp_bootpg(void)
+{
        /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
        if ((u64)gd->ram_size > 0xfffff000)
-               bootpg = 0xfff00000;
-       else
-               bootpg = gd->ram_size - (1024 * 1024);
+               return (0xfff00000);
+
+       return (gd->ram_size - (1024 * 1024));
+}
+
+void cpu_mp_lmb_reserve(struct lmb *lmb)
+{
+       u32 bootpg = determine_mp_bootpg();
 
        /* tell u-boot we stole a page */
        lmb_reserve(lmb, bootpg, 4096);
@@ -31,18 +56,9 @@ void setup_mp(void)
 {
        extern ulong __secondary_start_page;
        ulong fixup = (ulong)&__secondary_start_page;
-       u32 bootpg;
+       u32 bootpg = determine_mp_bootpg();
        u32 bootpg_va;
 
-       /*
-        * If we have 4G or more of memory, put the boot page at 4Gb-1M.
-        * Otherwise, put it at the very end of RAM.
-        */
-       if (gd->ram_size > 0xfffff000)
-               bootpg = 0xfff00000;
-       else
-               bootpg = gd->ram_size - (1024 * 1024);
-
        if (bootpg >= CONFIG_SYS_MAX_DDR_BAT_SIZE) {
                /* We're not covered by the DDR mapping, set up BAT  */
                write_bat(DBAT7, CONFIG_SYS_SCRATCH_VA | BATU_BL_128K |
@@ -65,4 +81,3 @@ void setup_mp(void)
                out_be32((uint *)(CONFIG_SYS_CCSRBAR + 0x20), 0x80000000 |
                         (bootpg >> 12));
 }
-#endif
diff --git a/cpu/mpc86xx/mp.h b/cpu/mpc86xx/mp.h
deleted file mode 100644 (file)
index 886e0c8..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __MPC86XX_MP_H_
-#define __MPC86XX_MP_H_
-
-void setup_mp(void);
-void cpu_mp_lmb_reserve(struct lmb *lmb);
-
-#endif
index 95efbb4f8032536e37052c00c6e3f4cffefc9cb9..67a6f2bdb5738a325089e14d9a7b3b59e010cffa 100644 (file)
@@ -41,7 +41,6 @@
  * Core 0 must copy this to a 1M aligned region and set BPTR
  * to point to it.
  */
-#if (CONFIG_NUM_CPUS > 1)
        .align 12
 .globl __secondary_start_page
 __secondary_start_page:
@@ -166,4 +165,3 @@ invl2:
        blr
 
        /* Never Returns, Running in Linux Now */
-#endif
diff --git a/include/asm-ppc/mp.h b/include/asm-ppc/mp.h
new file mode 100644 (file)
index 0000000..8a5486f
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
+ *
+ * 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_MP_H_
+#define _ASM_MP_H_
+
+#include <lmb.h>
+
+void setup_mp(void);
+void cpu_mp_lmb_reserve(struct lmb *lmb);
+u32 determine_mp_bootpg(void);
+
+#endif
+
index 9d661010d30aee92e85aa5582b075be9d071ec55..d8042fb764a4a24925cede9b3bade14f782ed1bb 100644 (file)
@@ -36,6 +36,7 @@
 #define CONFIG_MPC86xx         1       /* MPC86xx */
 #define CONFIG_MPC8641         1       /* MPC8641 specific */
 #define CONFIG_MPC8641HPCN     1       /* MPC8641HPCN board specific */
+#define CONFIG_MP              1       /* support multiple processors */
 #define CONFIG_NUM_CPUS                2       /* Number of CPUs in the system */
 #define CONFIG_LINUX_RESET_VEC 0x100   /* Reset vector used by Linux */
 /*#define CONFIG_PHYS_64BIT    1*/     /* Place devices in 36-bit space */
index 1008812b711ac9d7986196093820ddc596ffbf9c..ef0f627b6ca609230e77d53dcc594ad2f4d0a3ff 100644 (file)
@@ -40,6 +40,7 @@
 #define CONFIG_MPC86xx         1       /* MPC86xx */
 #define CONFIG_MPC8641         1       /* MPC8641 specific */
 #define CONFIG_SBC8641D                1       /* SBC8641D board specific */
+#define CONFIG_MP              1       /* support multiple processors */
 #define CONFIG_NUM_CPUS         2       /* Number of CPUs in the system */
 #define CONFIG_LINUX_RESET_VEC  0x100   /* Reset vector used by Linux */