Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 105c31df authored by Kumar Gala's avatar Kumar Gala
Browse files

powerpc/fsl-booke: Cleanup init/exception setup to be runtime



We currently have a few variants of fsl-booke processors (e500v1, e500v2,
e500mc, and e200).  They all have minor differences that we had previously
been handling via ifdefs.

To move towards having this support the following changes have been made:

* PID1, PID2 only exist on e500v1 & e500v2 and should not be accessed on
  e500mc or e200.  We use MMUCFG[NPIDS] to determine which case we are
  since we only touch PID1/2 in extremely early init code.

* Not all IVORs exist on all the processors so introduce cpu_setup
  functions for each variant to setup the proper IVORs that are either
  unique or exist but have some variations between the processors

Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 0585a155
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -110,6 +110,7 @@
#define SPRN_L1CSR0	0x3F2	/* L1 Cache Control and Status Register 0 */
#define SPRN_L1CSR0	0x3F2	/* L1 Cache Control and Status Register 0 */
#define SPRN_L1CSR1	0x3F3	/* L1 Cache Control and Status Register 1 */
#define SPRN_L1CSR1	0x3F3	/* L1 Cache Control and Status Register 1 */
#define SPRN_MMUCSR0	0x3F4	/* MMU Control and Status Register 0 */
#define SPRN_MMUCSR0	0x3F4	/* MMU Control and Status Register 0 */
#define SPRN_MMUCFG	0x3F7	/* MMU Configuration Register */
#define SPRN_PIT	0x3DB	/* Programmable Interval Timer */
#define SPRN_PIT	0x3DB	/* Programmable Interval Timer */
#define SPRN_BUCSR	0x3F5	/* Branch Unit Control and Status */
#define SPRN_BUCSR	0x3F5	/* Branch Unit Control and Status */
#define SPRN_L2CSR0	0x3F9	/* L2 Data Cache Control and Status Register 0 */
#define SPRN_L2CSR0	0x3F9	/* L2 Data Cache Control and Status Register 0 */
+1 −0
Original line number Original line Diff line number Diff line
@@ -61,6 +61,7 @@ obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o \
obj64-$(CONFIG_HIBERNATION)	+= swsusp_asm64.o
obj64-$(CONFIG_HIBERNATION)	+= swsusp_asm64.o
obj-$(CONFIG_MODULES)		+= module.o module_$(CONFIG_WORD_SIZE).o
obj-$(CONFIG_MODULES)		+= module.o module_$(CONFIG_WORD_SIZE).o
obj-$(CONFIG_44x)		+= cpu_setup_44x.o
obj-$(CONFIG_44x)		+= cpu_setup_44x.o
obj-$(CONFIG_FSL_BOOKE)		+= cpu_setup_fsl_booke.o


extra-$(CONFIG_PPC_STD_MMU)	:= head_32.o
extra-$(CONFIG_PPC_STD_MMU)	:= head_32.o
extra-$(CONFIG_PPC64)		:= head_64.o
extra-$(CONFIG_PPC64)		:= head_64.o
+31 −0
Original line number Original line Diff line number Diff line
/*
 * This file contains low level CPU setup functions.
 * Kumar Gala <galak@kernel.crashing.org>
 * Copyright 2009 Freescale Semiconductor, Inc.
 *
 * Based on cpu_setup_6xx code by
 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
 *
 * 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.
 *
 */

#include <asm/processor.h>
#include <asm/cputable.h>
#include <asm/ppc_asm.h>

_GLOBAL(__setup_cpu_e200)
	/* enable dedicated debug exception handling resources (Debug APU) */
	mfspr	r3,SPRN_HID0
	ori	r3,r3,HID0_DAPUEN@l
	mtspr	SPRN_HID0,r3
	b	__setup_e200_ivors
_GLOBAL(__setup_cpu_e500v1)
_GLOBAL(__setup_cpu_e500v2)
	b	__setup_e500_ivors
_GLOBAL(__setup_cpu_e500mc)
	b	__setup_e500mc_ivors
+8 −0
Original line number Original line Diff line number Diff line
@@ -35,6 +35,10 @@ const char *powerpc_base_platform;
 * and ppc64
 * and ppc64
 */
 */
#ifdef CONFIG_PPC32
#ifdef CONFIG_PPC32
extern void __setup_cpu_e200(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_e500v1(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_e500v2(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_e500mc(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_440ep(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_440ep(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_440gx(unsigned long offset, struct cpu_spec* spec);
extern void __setup_cpu_440gx(unsigned long offset, struct cpu_spec* spec);
@@ -1687,6 +1691,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
			PPC_FEATURE_UNIFIED_CACHE,
			PPC_FEATURE_UNIFIED_CACHE,
		.mmu_features		= MMU_FTR_TYPE_FSL_E,
		.mmu_features		= MMU_FTR_TYPE_FSL_E,
		.dcache_bsize		= 32,
		.dcache_bsize		= 32,
		.cpu_setup		= __setup_cpu_e200,
		.machine_check		= machine_check_e200,
		.machine_check		= machine_check_e200,
		.platform		= "ppc5554",
		.platform		= "ppc5554",
	}
	}
@@ -1706,6 +1711,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
		.num_pmcs		= 4,
		.num_pmcs		= 4,
		.oprofile_cpu_type	= "ppc/e500",
		.oprofile_cpu_type	= "ppc/e500",
		.oprofile_type		= PPC_OPROFILE_FSL_EMB,
		.oprofile_type		= PPC_OPROFILE_FSL_EMB,
		.cpu_setup		= __setup_cpu_e500v1,
		.machine_check		= machine_check_e500,
		.machine_check		= machine_check_e500,
		.platform		= "ppc8540",
		.platform		= "ppc8540",
	},
	},
@@ -1724,6 +1730,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
		.num_pmcs		= 4,
		.num_pmcs		= 4,
		.oprofile_cpu_type	= "ppc/e500",
		.oprofile_cpu_type	= "ppc/e500",
		.oprofile_type		= PPC_OPROFILE_FSL_EMB,
		.oprofile_type		= PPC_OPROFILE_FSL_EMB,
		.cpu_setup		= __setup_cpu_e500v2,
		.machine_check		= machine_check_e500,
		.machine_check		= machine_check_e500,
		.platform		= "ppc8548",
		.platform		= "ppc8548",
	},
	},
@@ -1739,6 +1746,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
		.num_pmcs		= 4,
		.num_pmcs		= 4,
		.oprofile_cpu_type	= "ppc/e500", /* xxx - galak, e500mc? */
		.oprofile_cpu_type	= "ppc/e500", /* xxx - galak, e500mc? */
		.oprofile_type		= PPC_OPROFILE_FSL_EMB,
		.oprofile_type		= PPC_OPROFILE_FSL_EMB,
		.cpu_setup		= __setup_cpu_e500mc,
		.machine_check		= machine_check_e500,
		.machine_check		= machine_check_e500,
		.platform		= "ppce500mc",
		.platform		= "ppce500mc",
	},
	},
+3 −3
Original line number Original line Diff line number Diff line
@@ -70,10 +70,10 @@


/* only on e500mc/e200 */
/* only on e500mc/e200 */
#define DEBUG_STACK_BASE	dbgirq_ctx
#define DEBUG_STACK_BASE	dbgirq_ctx
#ifdef CONFIG_PPC_E500MC
#ifdef CONFIG_E200
#define DEBUG_SPRG		SPRN_SPRG9
#else
#define DEBUG_SPRG		SPRN_SPRG6W
#define DEBUG_SPRG		SPRN_SPRG6W
#else
#define DEBUG_SPRG		SPRN_SPRG9
#endif
#endif


#define EXC_LVL_FRAME_OVERHEAD	(THREAD_SIZE - INT_FRAME_SIZE - EXC_LVL_SIZE)
#define EXC_LVL_FRAME_OVERHEAD	(THREAD_SIZE - INT_FRAME_SIZE - EXC_LVL_SIZE)
Loading