* [PATCH 01/14] ppc: remove mgt5100 support from code
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 02/14] ppc: add a get_pc() function Sascha Hauer
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
This has never been used in barebox and likely is incomplete
and bitrotted over time, so remove it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/mach-mpc5xxx/cpu.c | 7 -------
arch/ppc/mach-mpc5xxx/cpu_init.c | 13 +------------
arch/ppc/mach-mpc5xxx/start.S | 9 +--------
3 files changed, 2 insertions(+), 27 deletions(-)
diff --git a/arch/ppc/mach-mpc5xxx/cpu.c b/arch/ppc/mach-mpc5xxx/cpu.c
index be7c19d..391c705 100644
--- a/arch/ppc/mach-mpc5xxx/cpu.c
+++ b/arch/ppc/mach-mpc5xxx/cpu.c
@@ -41,16 +41,10 @@
int checkcpu (void)
{
ulong clock = get_cpu_clock();
-#ifndef CONFIG_MGT5100
uint svr, pvr;
-#endif
puts ("CPU: ");
-#ifdef CONFIG_MGT5100
- puts (CPU_ID_STR);
- printf (" (JTAG ID %08lx)", *(vu_long *)MPC5XXX_CDM_JTAGID);
-#else
svr = get_svr();
pvr = get_pvr();
switch (SVR_VER (svr)) {
@@ -64,7 +58,6 @@ int checkcpu (void)
printf (" v%d.%d, Core v%d.%d", SVR_MJREV (svr), SVR_MNREV (svr),
PVR_MAJ(pvr), PVR_MIN(pvr));
-#endif
printf (" at %ld Hz\n", clock);
return 0;
}
diff --git a/arch/ppc/mach-mpc5xxx/cpu_init.c b/arch/ppc/mach-mpc5xxx/cpu_init.c
index fc5db0e..24edc48 100644
--- a/arch/ppc/mach-mpc5xxx/cpu_init.c
+++ b/arch/ppc/mach-mpc5xxx/cpu_init.c
@@ -36,10 +36,6 @@ int cpu_init(void)
{
unsigned long addecr = (1 << 25); /* Boot_CS */
-#if defined(CFG_RAMBOOT) && defined(CONFIG_MGT5100)
- addecr |= (1 << 22); /* SDRAM enable */
-#endif
-
/*
* Memory Controller: configure chip selects and enable them
*/
@@ -107,7 +103,6 @@ int cpu_init(void)
*(vu_long *)MPC5XXX_CS5_CFG = CFG_CS5_CFG;
#endif
-#if defined(CONFIG_MPC5200)
addecr |= 1;
#if defined(CFG_CS6_START) && defined(CFG_CS6_SIZE)
*(vu_long *)MPC5XXX_CS6_START = START_REG(CFG_CS6_START);
@@ -133,7 +128,6 @@ int cpu_init(void)
#if defined(CFG_CS_DEADCYCLE)
*(vu_long *)MPC5XXX_CS_DEADCYCLE = CFG_CS_DEADCYCLE;
#endif
-#endif /* CONFIG_MPC5200 */
/* Enable chip selects */
*(vu_long *)MPC5XXX_ADDECR = addecr;
@@ -144,7 +138,6 @@ int cpu_init(void)
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG = CFG_GPS_PORT_CONFIG;
#endif
-#if defined(CONFIG_MPC5200)
/* enable timebase */
*(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 13);
@@ -175,14 +168,10 @@ int cpu_init(void)
/* Enable piplining */
*(vu_long *)(MPC5XXX_XLBARB + 0x40) &= ~(1 << 31);
# endif
-#endif /* CONFIG_MPC5200 */
/* mask all interrupts */
-#if defined(CONFIG_MGT5100)
- *(vu_long *)MPC5XXX_ICTL_PER_MASK = 0xfffffc00;
-#elif defined(CONFIG_MPC5200)
*(vu_long *)MPC5XXX_ICTL_PER_MASK = 0xffffff00;
-#endif
+
*(vu_long *)MPC5XXX_ICTL_CRIT |= 0x0001ffff;
*(vu_long *)MPC5XXX_ICTL_EXT &= ~0x00000f00;
/* route critical ints to normal ints */
diff --git a/arch/ppc/mach-mpc5xxx/start.S b/arch/ppc/mach-mpc5xxx/start.S
index 8fca31b..3ba7208 100644
--- a/arch/ppc/mach-mpc5xxx/start.S
+++ b/arch/ppc/mach-mpc5xxx/start.S
@@ -91,9 +91,6 @@ boot_warm:
# if defined(CFG_RAMBOOT)
# error CFG_LOWBOOT is incompatible with CFG_RAMBOOT
# endif /* CFG_RAMBOOT */
-# if defined(CONFIG_MGT5100)
-# error CFG_LOWBOOT is incompatible with MGT5100
-# endif /* CONFIG_MGT5100 */
lis r4, CFG_DEFAULT_MBAR@h
lis r3, START_REG(CFG_BOOTCS_START)@h
ori r3, r3, START_REG(CFG_BOOTCS_START)@l
@@ -125,14 +122,10 @@ lowboot_reentry:
#if defined(CFG_DEFAULT_MBAR) && !defined(CFG_RAMBOOT)
lis r3, CFG_MBAR@h
ori r3, r3, CFG_MBAR@l
-#if defined(CONFIG_MPC5200)
/* MBAR is mirrored into the MBAR SPR */
mtspr MBAR,r3
rlwinm r3, r3, 16, 16, 31
-#endif
-#if defined(CONFIG_MGT5100)
- rlwinm r3, r3, 17, 15, 31
-#endif
+
lis r4, CFG_DEFAULT_MBAR@h
stw r3, 0(r4)
#endif /* CFG_DEFAULT_MBAR */
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 02/14] ppc: add a get_pc() function
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
2011-09-27 8:28 ` [PATCH 01/14] ppc: remove mgt5100 support from code Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 03/14] remove EARLY_INIT and EARLY_CONSOLE support Sascha Hauer
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
Useful to determine whether sdram has to be setup or not.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/include/asm/common.h | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/include/asm/common.h b/arch/ppc/include/asm/common.h
index 96de5c6..26876c7 100644
--- a/arch/ppc/include/asm/common.h
+++ b/arch/ppc/include/asm/common.h
@@ -21,4 +21,21 @@ void trap_init (ulong);
int cpu_init_board_data(bd_t *bd);
int init_board_data(bd_t *bd);
+static inline unsigned long get_pc(void)
+{
+ unsigned long pc;
+
+ __asm__ __volatile__(
+ " mflr 0\n"
+ " bl 1f\n"
+ "1:\n"
+ " mflr %0\n"
+ " mtlr 0\n"
+ : "=r" (pc)
+ :
+ : "0", "memory");
+
+ return pc;
+}
+
#endif /* __ASM_COMMON_H */
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 03/14] remove EARLY_INIT and EARLY_CONSOLE support
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
2011-09-27 8:28 ` [PATCH 01/14] ppc: remove mgt5100 support from code Sascha Hauer
2011-09-27 8:28 ` [PATCH 02/14] ppc: add a get_pc() function Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 04/14] ppc mpc5200: add function to determine configured sdram size Sascha Hauer
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
Bitrotted over time and nearly unused, so remove it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/karo-tx28/tx28-stk5.c | 1 -
arch/mips/lib/barebox.lds.S | 4 --
arch/ppc/Kconfig | 9 -----
arch/ppc/boards/pcm030/barebox.lds.S | 4 --
arch/ppc/boards/pcm030/pcm030.c | 13 +------
arch/ppc/include/asm/common.h | 2 +
arch/ppc/lib/board.c | 3 --
arch/ppc/mach-mpc5xxx/Kconfig | 3 --
arch/ppc/mach-mpc5xxx/cpu_init.c | 3 --
arch/ppc/mach-mpc5xxx/start.S | 15 --------
common/Kconfig | 17 ---------
common/console.c | 36 ++-----------------
common/startup.c | 28 ---------------
common/version.c | 5 +--
drivers/serial/serial_mpc5xxx.c | 25 -------------
include/linux/ctype.h | 3 +-
include/reloc.h | 62 ---------------------------------
lib/vsprintf.c | 1 -
18 files changed, 10 insertions(+), 224 deletions(-)
delete mode 100644 include/reloc.h
diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c
index 645aa7b..b36d822 100644
--- a/arch/arm/boards/karo-tx28/tx28-stk5.c
+++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
@@ -20,7 +20,6 @@
#include <mci.h>
#include <fec.h>
#include <sizes.h>
-#include <reloc.h>
#include <io.h>
#include <asm/sections.h>
#include <mach/imx-regs.h>
diff --git a/arch/mips/lib/barebox.lds.S b/arch/mips/lib/barebox.lds.S
index dd9eab7..ba4c0af 100644
--- a/arch/mips/lib/barebox.lds.S
+++ b/arch/mips/lib/barebox.lds.S
@@ -64,10 +64,6 @@ SECTIONS
__usymtab : { BAREBOX_SYMS }
__usymtab_end = .;
- __early_init_data_begin = .;
- .early_init_data : { *(.early_init_data) }
- __early_init_data_end = .;
-
. = ALIGN(4);
__bss_start = .;
.bss : { *(.bss*) }
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index cda14de..50ccaac 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -7,15 +7,6 @@ config ARCH_TEXT_BASE
default 0x00000000 if RELOCATABLE
default 0x01000000 if MACH_PHYCORE_MPC5200B_TINY
-config MPC5XXX_EARLY_CONSOLE
- bool
- depends on ARCH_MPC5200
- default y
-
-config HAS_EARLY_INIT
- bool
- default y
-
config PPC
bool
select HAVE_CONFIGURABLE_TEXT_BASE
diff --git a/arch/ppc/boards/pcm030/barebox.lds.S b/arch/ppc/boards/pcm030/barebox.lds.S
index 21bf4a7..4aacfc5 100644
--- a/arch/ppc/boards/pcm030/barebox.lds.S
+++ b/arch/ppc/boards/pcm030/barebox.lds.S
@@ -111,10 +111,6 @@ SECTIONS
__usymtab : { BAREBOX_SYMS }
__usymtab_end = .;
- __early_init_data_begin = .;
- .early_init_data : { *(.early_init_data) }
- __early_init_data_end = .;
-
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
diff --git a/arch/ppc/boards/pcm030/pcm030.c b/arch/ppc/boards/pcm030/pcm030.c
index d3b7094..f408c3d 100644
--- a/arch/ppc/boards/pcm030/pcm030.c
+++ b/arch/ppc/boards/pcm030/pcm030.c
@@ -35,7 +35,7 @@
#include <types.h>
#include <partition.h>
#include <memory.h>
-#include <reloc.h>
+#include <sizes.h>
static struct mpc5xxx_fec_platform_data fec_info = {
.xcv_type = MII100,
@@ -68,15 +68,6 @@ static int console_init(void)
console_initcall(console_init);
-void *get_early_console_base(const char *name)
-{
- if (!strcmp(name, RELOC("psc3")))
- return (void *)MPC5XXX_PSC3;
- if (!strcmp(name, RELOC("psc6")))
- return (void *)MPC5XXX_PSC6;
- return NULL;
-}
-
#include "mt46v32m16-75.h"
static void sdram_start (int hi_addr)
@@ -131,7 +122,7 @@ long int initdram (int board_type)
ulong test1, test2;
- if ((ulong)RELOC(initdram) > (2 << 30)) {
+ if (get_pc() > SZ_128M) {
/* setup SDRAM chip selects */
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001b;/* 256MB at 0x0 */
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x10000000;/* disabled */
diff --git a/arch/ppc/include/asm/common.h b/arch/ppc/include/asm/common.h
index 26876c7..9239de4 100644
--- a/arch/ppc/include/asm/common.h
+++ b/arch/ppc/include/asm/common.h
@@ -3,6 +3,8 @@
#include <asm/barebox.h>
+extern unsigned long _text_base;
+
void upmconfig (unsigned int, unsigned int *, unsigned int);
ulong get_tbclk (void);
diff --git a/arch/ppc/lib/board.c b/arch/ppc/lib/board.c
index 798c386..82ba458 100644
--- a/arch/ppc/lib/board.c
+++ b/arch/ppc/lib/board.c
@@ -29,7 +29,6 @@
#include <memory.h>
#include <init.h>
#include <net.h>
-#include <reloc.h>
#include <asm-generic/memory_layout.h>
/************************************************************************
@@ -48,8 +47,6 @@ void board_init_r (ulong end_of_ram)
asm ("sync ; isync");
- _text_base += reloc_offset();
-
/*
* FIXME: 128k stack size. Is this enough? should
* it be configurable?
diff --git a/arch/ppc/mach-mpc5xxx/Kconfig b/arch/ppc/mach-mpc5xxx/Kconfig
index 5da6a5b..632fb85 100644
--- a/arch/ppc/mach-mpc5xxx/Kconfig
+++ b/arch/ppc/mach-mpc5xxx/Kconfig
@@ -10,6 +10,3 @@ config MACH_PHYCORE_MPC5200B_TINY_REV
old board you should set this option to 1
endmenu
-
-config EARLY_CONSOLE_PORT
- default "psc3" if MACH_PHYCORE_MPC5200B_TINY
\ No newline at end of file
diff --git a/arch/ppc/mach-mpc5xxx/cpu_init.c b/arch/ppc/mach-mpc5xxx/cpu_init.c
index 24edc48..bf0a5bd 100644
--- a/arch/ppc/mach-mpc5xxx/cpu_init.c
+++ b/arch/ppc/mach-mpc5xxx/cpu_init.c
@@ -24,7 +24,6 @@
#include <common.h>
#include <mach/mpc5xxx.h>
#include <types.h>
-#include <reloc.h>
/*
* Breath some life into the CPU...
@@ -177,8 +176,6 @@ int cpu_init(void)
/* route critical ints to normal ints */
*(vu_long *)MPC5XXX_ICTL_EXT |= 0x00000001;
- early_init();
-
return 0;
}
diff --git a/arch/ppc/mach-mpc5xxx/start.S b/arch/ppc/mach-mpc5xxx/start.S
index 3ba7208..2627e5d 100644
--- a/arch/ppc/mach-mpc5xxx/start.S
+++ b/arch/ppc/mach-mpc5xxx/start.S
@@ -802,21 +802,6 @@ trap_reloc:
blr
- .globl reloc_offset
-reloc_offset:
- mfspr r4, LR
- bl pc
-pc:
- mfspr r3, LR
- mtspr LR, r4
- addi r4, r3, (_text_base - pc)
- subi r3, r3, (pc - _start)
- lwz r4, 0(r4)
-
- sub r3, r3, r4
- subi r3, r3, 0x100
- blr
-
.globl _text_base
_text_base:
.long TEXT_BASE
diff --git a/common/Kconfig b/common/Kconfig
index 82e43aa..8e96920 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -398,23 +398,6 @@ config CONSOLE_ACTIVATE_ALL
Enabling this options activates all consoles on startup, so
you will get output and a prompt on all consoles simultaneously.
-config EARLY_CONSOLE_PORT
- string
- depends on HAS_EARLY_INIT
- prompt "Console device for early output"
- help
- Choose the device on which you want to have early output printed
- to. This is only used during startup when no device information
- is available.
-
-config EARLY_CONSOLE_BAUDRATE
- int
- default 115200
- depends on HAS_EARLY_INIT
- prompt "Early console baudrate"
- help
- Choose the baudrate for your early console.
-
config OF_FLAT_TREE
bool
prompt "Open Firmware flat device tree support"
diff --git a/common/console.c b/common/console.c
index 1f6ee93..06e9c29 100644
--- a/common/console.c
+++ b/common/console.c
@@ -29,7 +29,6 @@
#include <console.h>
#include <driver.h>
#include <fs.h>
-#include <reloc.h>
#include <init.h>
#include <clock.h>
#include <kfifo.h>
@@ -42,10 +41,9 @@ LIST_HEAD(console_list);
EXPORT_SYMBOL(console_list);
#define CONSOLE_UNINITIALIZED 0
-#define CONSOLE_INIT_EARLY 1
-#define CONSOLE_INIT_FULL 2
+#define CONSOLE_INIT_FULL 1
-static int __early_initdata initialized = 0;
+static int initialized = 0;
static int console_std_set(struct device_d *dev, struct param_d *param,
const char *val)
@@ -163,10 +161,8 @@ int console_register(struct console_device *newcdev)
console_output_buffer = NULL;
}
-#ifndef CONFIG_HAS_EARLY_INIT
if (first)
barebox_banner();
-#endif
return 0;
}
@@ -250,26 +246,16 @@ int tstc(void)
}
EXPORT_SYMBOL(tstc);
-#ifdef CONFIG_HAS_EARLY_INIT
-static void __early_initdata *early_console_base;
-#endif
-
void console_putc(unsigned int ch, char c)
{
struct console_device *cdev;
- int init = INITDATA(initialized);
+ int init = initialized;
switch (init) {
case CONSOLE_UNINITIALIZED:
kfifo_putc(console_output_buffer, c);
return;
-#ifdef CONFIG_HAS_EARLY_INIT
- case CONSOLE_INIT_EARLY:
- early_console_putc(INITDATA(early_console_base), c);
- return;
-#endif
-
case CONSOLE_INIT_FULL:
for_each_console(cdev) {
if (cdev->f_active & ch) {
@@ -410,19 +396,3 @@ int ctrlc (void)
}
EXPORT_SYMBOL(ctrlc);
#endif /* ARCH_HAS_CTRC */
-
-#ifdef CONFIG_HAS_EARLY_INIT
-
-void early_console_start(const char *name, int baudrate)
-{
- void *base = get_early_console_base(name);
-
- if (base) {
- early_console_init(base, baudrate);
- INITDATA(initialized) = CONSOLE_INIT_EARLY;
- INITDATA(early_console_base) = base;
- barebox_banner();
- }
-}
-
-#endif
diff --git a/common/startup.c b/common/startup.c
index 7a1b602..13783fb 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -38,7 +38,6 @@
#include <fs.h>
#include <linux/stat.h>
#include <environment.h>
-#include <reloc.h>
#include <asm-generic/memory_layout.h>
#include <asm/sections.h>
@@ -62,23 +61,6 @@ static void display_meminfo(void)
#endif
}
-#ifdef CONFIG_HAS_EARLY_INIT
-
-#define EARLY_INITDATA (CFG_INIT_RAM_ADDR + CFG_INIT_RAM_SIZE \
- - CONFIG_EARLY_INITDATA_SIZE)
-
-void *init_data_ptr = (void *)EARLY_INITDATA;
-
-void early_init (void)
-{
- /* copy the early initdata segment to early init RAM */
- memcpy((void *)EARLY_INITDATA, RELOC(&__early_init_data_begin),
- (ulong)&__early_init_data_end -
- (ulong)&__early_init_data_begin);
-}
-
-#endif /* CONFIG_HAS_EARLY_INIT */
-
#ifdef CONFIG_DEFAULT_ENVIRONMENT
#include <generated/barebox_default_env.h>
@@ -112,16 +94,6 @@ void start_barebox (void)
struct stat s;
#endif
-#ifdef CONFIG_HAS_EARLY_INIT
- /* We are running from RAM now, copy early initdata from
- * early RAM to RAM
- */
- memcpy(&__early_init_data_begin, init_data_ptr,
- (ulong)&__early_init_data_end -
- (ulong)&__early_init_data_begin);
- init_data_ptr = &__early_init_data_begin;
-#endif /* CONFIG_HAS_EARLY_INIT */
-
for (initcall = __barebox_initcalls_start;
initcall < __barebox_initcalls_end; initcall++) {
PUTS_LL("<<");
diff --git a/common/version.c b/common/version.c
index 945475f..0af8ec1 100644
--- a/common/version.c
+++ b/common/version.c
@@ -1,5 +1,4 @@
#include <common.h>
-#include <reloc.h>
#include <generated/utsrelease.h>
const char version_string[] =
@@ -7,7 +6,7 @@ const char version_string[] =
void barebox_banner (void)
{
- printf (RELOC("\n\n%s\n\n"), RELOC_VAR(version_string));
- printf(RELOC("Board: " CONFIG_BOARDINFO "\n"));
+ printf("\n\n%s\n\n", version_string);
+ printf("Board: " CONFIG_BOARDINFO "\n");
}
diff --git a/drivers/serial/serial_mpc5xxx.c b/drivers/serial/serial_mpc5xxx.c
index fb580cf..b00b442 100644
--- a/drivers/serial/serial_mpc5xxx.c
+++ b/drivers/serial/serial_mpc5xxx.c
@@ -39,7 +39,6 @@
#include <init.h>
#include <console.h>
#include <xfuncs.h>
-#include <reloc.h>
#include <mach/clocks.h>
static int __mpc5xxx_serial_setbaudrate(struct mpc5xxx_psc *psc, int baudrate)
@@ -180,27 +179,3 @@ static int mpc5xxx_serial_register(void)
}
console_initcall(mpc5xxx_serial_register);
-
-#ifdef CONFIG_MPC5XXX_EARLY_CONSOLE
-
-void early_console_putc(void *base, char c)
-{
- struct mpc5xxx_psc *psc =
- (struct mpc5xxx_psc *)base;
-
- /* Wait for last character to go. */
- while (!(psc->psc_status & PSC_SR_TXEMP))
- ;
-
- psc->psc_buffer_8 = c;
-}
-
-void early_console_init(void *base, int baudrate)
-{
- struct mpc5xxx_psc *psc =
- (struct mpc5xxx_psc *)base;
- __mpc5xxx_serial_init(psc);
- __mpc5xxx_serial_setbaudrate(psc, baudrate);
-}
-
-#endif
diff --git a/include/linux/ctype.h b/include/linux/ctype.h
index 728040e..74fb735 100644
--- a/include/linux/ctype.h
+++ b/include/linux/ctype.h
@@ -2,7 +2,6 @@
#define _LINUX_CTYPE_H
#include <common.h>
-#include <reloc.h>
/*
* NOTE! This ctype does not handle EOF like the standard C
@@ -20,7 +19,7 @@
extern unsigned char _ctype[];
-#define __ismask(x) (RELOC_VAR(_ctype[(int)(unsigned char)(x)]))
+#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
diff --git a/include/reloc.h b/include/reloc.h
deleted file mode 100644
index cc99866..0000000
--- a/include/reloc.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef __RELOC_H
-#define __RELOC_H
-
-extern unsigned long _text_base;
-
-#ifdef CONFIG_HAS_EARLY_INIT
-
-extern ulong __early_init_data_begin, __early_init_data_end;
-
-/*
- * The difference between our link address and the address we're
- * currently running at.
- */
-unsigned long reloc_offset(void);
-
-/*
- * When not running at link address, relocate a pointer by
- * taking reloc_offset() into account
- */
-#define RELOC(a) (typeof(*a) *)((unsigned long)a + reloc_offset())
-
-/*
- * dito, used for variables
- */
-#define RELOC_VAR(v) *(typeof(v)* )((unsigned long)&v + reloc_offset())
-
-void early_init(void);
-
-/*
- * put a variable into early init RAM. This section will
- * be relocated into SRAM during early init
- */
-#define __early_initdata __attribute__ ((__section__ (".early_init_data")))
-
-/* Access init data */
-#define INITDATA(var) *(typeof(var) *)((ulong)(&var) - \
- (ulong)&__early_init_data_begin + \
- (ulong)RELOC_VAR(init_data_ptr))
-
-extern void *init_data_ptr;
-
-#else
-
-static inline int reloc_offset(void)
-{
- return 0;
-}
-
-static inline void early_init(void)
-{
-}
-
-#define RELOC(a) a
-#define RELOC_VAR(v) v
-
-#define __early_initdata
-
-#define INITDATA(var) var
-
-#endif /* CONFIG_HAS_EARLY_INIT */
-
-#endif /* __RELOC_H */
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index ccccc5d..54e162f 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -19,7 +19,6 @@
#include <common.h>
#include <led.h>
-#include <reloc.h>
unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
{
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 04/14] ppc mpc5200: add function to determine configured sdram size
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (2 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 03/14] remove EARLY_INIT and EARLY_CONSOLE support Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 05/14] ppc mpc5200: add function to configure a chipselect Sascha Hauer
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/mach-mpc5xxx/cpu.c | 17 +++++++++++++++++
arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h | 3 +++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/mach-mpc5xxx/cpu.c b/arch/ppc/mach-mpc5xxx/cpu.c
index 391c705..cf2ca2f 100644
--- a/arch/ppc/mach-mpc5xxx/cpu.c
+++ b/arch/ppc/mach-mpc5xxx/cpu.c
@@ -113,3 +113,20 @@ int cpu_init_board_data(bd_t *bd)
bd->bi_pcifreq = get_pci_clock();
return 0;
}
+
+unsigned long mpc5200_get_sdram_size(unsigned int cs)
+{
+ unsigned long size;
+
+ if (cs > 1)
+ return 0;
+
+ /* retrieve size of memory connected to SDRAM CS0 */
+ size = *(vu_long *)(MPC5XXX_SDRAM_CS0CFG + (cs * 4)) & 0xFF;
+ if (size >= 0x13)
+ size = (1 << (size - 0x13)) << 20;
+ else
+ size = 0;
+
+ return size;
+}
diff --git a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
index d7d0811..aad2418 100644
--- a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
+++ b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
@@ -779,6 +779,9 @@ struct mpc5xxx_mscan {
/* function prototypes */
void loadtask(int basetask, int tasks);
+/* retrieve configured sdram size connected to a chipselect */
+unsigned long mpc5200_get_sdram_size(unsigned int cs);
+
#endif /* __ASSEMBLY__ */
#endif /* __ASMPPC_MPC5XXX_H */
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 05/14] ppc mpc5200: add function to configure a chipselect
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (3 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 04/14] ppc mpc5200: add function to determine configured sdram size Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 06/14] ppc mpc5200: add function to setup bus clocks Sascha Hauer
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/mach-mpc5xxx/cpu.c | 70 ++++++++++++++++++++++++++
arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h | 4 ++
2 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/mach-mpc5xxx/cpu.c b/arch/ppc/mach-mpc5xxx/cpu.c
index cf2ca2f..649f08a 100644
--- a/arch/ppc/mach-mpc5xxx/cpu.c
+++ b/arch/ppc/mach-mpc5xxx/cpu.c
@@ -30,6 +30,7 @@
#include <mach/mpc5xxx.h>
#include <asm/processor.h>
#include <asm/byteorder.h>
+#include <asm/io.h>
#include <init.h>
#include <types.h>
#include <mach/clocks.h>
@@ -130,3 +131,72 @@ unsigned long mpc5200_get_sdram_size(unsigned int cs)
return size;
}
+
+struct mpc5200_cs {
+ void *start;
+ void *stop;
+ void *cfg;
+ unsigned int addecr;
+};
+
+static struct mpc5200_cs chipselects[] = {
+ {
+ .start = (void *)MPC5XXX_CS0_START,
+ .stop = (void *)MPC5XXX_CS0_STOP,
+ .cfg = (void *)MPC5XXX_CS0_CFG,
+ .addecr = 1 << 16,
+ }, {
+ .start = (void *)MPC5XXX_CS1_START,
+ .stop = (void *)MPC5XXX_CS1_STOP,
+ .cfg = (void *)MPC5XXX_CS1_CFG,
+ .addecr = 1 << 17,
+ }, {
+ .start = (void *)MPC5XXX_CS2_START,
+ .stop = (void *)MPC5XXX_CS2_STOP,
+ .cfg = (void *)MPC5XXX_CS2_CFG,
+ .addecr = 1 << 18,
+ }, {
+ .start = (void *)MPC5XXX_CS3_START,
+ .stop = (void *)MPC5XXX_CS3_STOP,
+ .cfg = (void *)MPC5XXX_CS3_CFG,
+ .addecr = 1 << 19,
+ }, {
+ .start = (void *)MPC5XXX_CS4_START,
+ .stop = (void *)MPC5XXX_CS4_STOP,
+ .cfg = (void *)MPC5XXX_CS4_CFG,
+ .addecr = 1 << 20,
+ }, {
+ .start = (void *)MPC5XXX_CS5_START,
+ .stop = (void *)MPC5XXX_CS5_STOP,
+ .cfg = (void *)MPC5XXX_CS5_CFG,
+ .addecr = 1 << 21,
+ }, {
+ .start = (void *)MPC5XXX_CS6_START,
+ .stop = (void *)MPC5XXX_CS6_STOP,
+ .cfg = (void *)MPC5XXX_CS6_CFG,
+ .addecr = 1 << 26,
+ }, {
+ .start = (void *)MPC5XXX_CS7_START,
+ .stop = (void *)MPC5XXX_CS7_STOP,
+ .cfg = (void *)MPC5XXX_CS7_CFG,
+ .addecr = 1 << 27,
+ }, {
+ .start = (void *)MPC5XXX_BOOTCS_START,
+ .stop = (void *)MPC5XXX_BOOTCS_STOP,
+ .cfg = (void *)MPC5XXX_CS0_CFG,
+ .addecr = 1 << 25,
+ },
+};
+
+void mpc5200_setup_cs(int cs, unsigned long start, unsigned long size, u32 cfg)
+{
+ u32 addecr;
+
+ out_be32(chipselects[cs].start, START_REG(start));
+ out_be32(chipselects[cs].stop, STOP_REG(start, size));
+ out_be32(chipselects[cs].cfg, cfg);
+
+ addecr = in_be32((void *)MPC5XXX_ADDECR);
+ addecr |= chipselects[cs].addecr | 1;
+ out_be32((void *)MPC5XXX_ADDECR, addecr);
+}
diff --git a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
index aad2418..558f331 100644
--- a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
+++ b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
@@ -782,6 +782,10 @@ void loadtask(int basetask, int tasks);
/* retrieve configured sdram size connected to a chipselect */
unsigned long mpc5200_get_sdram_size(unsigned int cs);
+/* configure a local plus bus chip select */
+#define MPC5200_BOOTCS 8
+void mpc5200_setup_cs(int cs, unsigned long start, unsigned long size, u32 cfg);
+
#endif /* __ASSEMBLY__ */
#endif /* __ASMPPC_MPC5XXX_H */
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 06/14] ppc mpc5200: add function to setup bus clocks
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (4 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 05/14] ppc mpc5200: add function to configure a chipselect Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 07/14] ppc mpc5200b: cleanup lowlevel startup Sascha Hauer
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/mach-mpc5xxx/cpu.c | 38 ++++++++++++++++++++++++++
arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h | 3 ++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/mach-mpc5xxx/cpu.c b/arch/ppc/mach-mpc5xxx/cpu.c
index 649f08a..d695b9b 100644
--- a/arch/ppc/mach-mpc5xxx/cpu.c
+++ b/arch/ppc/mach-mpc5xxx/cpu.c
@@ -33,6 +33,7 @@
#include <asm/io.h>
#include <init.h>
#include <types.h>
+#include <errno.h>
#include <mach/clocks.h>
#if defined(CONFIG_OF_FLAT_TREE)
@@ -132,6 +133,43 @@ unsigned long mpc5200_get_sdram_size(unsigned int cs)
return size;
}
+int mpc5200_setup_bus_clocks(unsigned int ipbdiv, unsigned long pcidiv)
+{
+ u32 cdmcfg = *(vu_long *)MPC5XXX_CDM_CFG;
+
+ cdmcfg &= ~0x103;
+
+ switch (ipbdiv) {
+ case 1:
+ break;
+ case 2:
+ cdmcfg |= 0x100;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ switch (pcidiv) {
+ case 1:
+ if (ipbdiv == 2)
+ return -EINVAL;
+ break;
+ case 2:
+ if (ipbdiv == 1)
+ cdmcfg |= 0x1; /* ipb / 2 */
+ break;
+ case 4:
+ cdmcfg |= 0x2; /* xlb / 4 */
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ *(vu_long *)MPC5XXX_CDM_CFG = cdmcfg;
+
+ return 0;
+}
+
struct mpc5200_cs {
void *start;
void *stop;
diff --git a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
index 558f331..8e95dd0 100644
--- a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
+++ b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
@@ -786,6 +786,9 @@ unsigned long mpc5200_get_sdram_size(unsigned int cs);
#define MPC5200_BOOTCS 8
void mpc5200_setup_cs(int cs, unsigned long start, unsigned long size, u32 cfg);
+/* configure bus speeds. Both dividers are relative to xlb clock */
+int mpc5200_setup_bus_clocks(unsigned int ipbdiv, unsigned long pcidiv);
+
#endif /* __ASSEMBLY__ */
#endif /* __ASMPPC_MPC5XXX_H */
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 07/14] ppc mpc5200b: cleanup lowlevel startup
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (5 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 06/14] ppc mpc5200: add function to setup bus clocks Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 08/14] pcm030: use new functionality Sascha Hauer
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
The old startup process consisted of several CFG_LOWBOOT,
CFG_RAMBOOT ifdeffery which I do not understand. So remove
all this and replace it with:
- put the entry point for second stage loaders to offset 0x0
so that we can do a go /dev/ram0 to start a second barebox
- When we come from the reset vector assume MBAR is at 0x80000000
- When we come from the second stage entry assume that
SPR 311 is in sync with the current MBAR address.
- Switch MBAR to 0xf0000000 and we are done.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/mach-mpc5xxx/start.S | 75 ++++++++++------------------------------
1 files changed, 19 insertions(+), 56 deletions(-)
diff --git a/arch/ppc/mach-mpc5xxx/start.S b/arch/ppc/mach-mpc5xxx/start.S
index 2627e5d..d619460 100644
--- a/arch/ppc/mach-mpc5xxx/start.S
+++ b/arch/ppc/mach-mpc5xxx/start.S
@@ -66,69 +66,32 @@
* Exception vectors
*/
.text
+ /*
+ * Second stage loader entry. When entered here we assume that spr 311
+ * is set to the current MBAR address.
+ */
+ mfspr r4, MBAR
+ b setup_mbar
. = EXC_OFF_SYS_RESET
.globl _start
_start:
- li r21, BOOTFLAG_COLD /* Normal Power-On */
- nop
- b boot_cold
-
- . = EXC_OFF_SYS_RESET + 0x10
-
- .globl _start_warm
-_start_warm:
- li r21, BOOTFLAG_WARM /* Software reboot */
- b boot_warm
+ /*
+ * Reset entry. When entered here we assume that MBAR is at reset default
+ * 0x80000000.
+ */
+ lis r4, 0x80000000@h
+ ori r4, r4, 0x80000000@l
-boot_cold:
-boot_warm:
+setup_mbar:
+ /* r4 == current MBAR */
mfmsr r5 /* save msr contents */
- /* Move CSBoot and adjust instruction pointer */
- /*--------------------------------------------------------------*/
-
-#if defined(CFG_LOWBOOT)
-# if defined(CFG_RAMBOOT)
-# error CFG_LOWBOOT is incompatible with CFG_RAMBOOT
-# endif /* CFG_RAMBOOT */
- lis r4, CFG_DEFAULT_MBAR@h
- lis r3, START_REG(CFG_BOOTCS_START)@h
- ori r3, r3, START_REG(CFG_BOOTCS_START)@l
- stw r3, 0x4(r4) /* CS0 start */
- lis r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@h
- ori r3, r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@l
- stw r3, 0x8(r4) /* CS0 stop */
- lis r3, 0x02010000@h
- ori r3, r3, 0x02010000@l
- stw r3, 0x54(r4) /* CS0 and Boot enable */
-
- lis r3, lowboot_reentry@h /* jump from bootlow address space (0x0000xxxx) */
- ori r3, r3, lowboot_reentry@l /* to the address space the linker used */
- mtlr r3
- blr
-
-lowboot_reentry:
- lis r3, START_REG(CFG_BOOTCS_START)@h
- ori r3, r3, START_REG(CFG_BOOTCS_START)@l
- stw r3, 0x4c(r4) /* Boot start */
- lis r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@h
- ori r3, r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@l
- stw r3, 0x50(r4) /* Boot stop */
- lis r3, 0x02000001@h
- ori r3, r3, 0x02000001@l
- stw r3, 0x54(r4) /* Boot enable, CS0 disable */
-#endif /* CFG_LOWBOOT */
-
-#if defined(CFG_DEFAULT_MBAR) && !defined(CFG_RAMBOOT)
- lis r3, CFG_MBAR@h
- ori r3, r3, CFG_MBAR@l
- /* MBAR is mirrored into the MBAR SPR */
- mtspr MBAR,r3
+ /* Switch MBAR to 0xf0000000 */
+ lis r3, 0xf0000000@h
+ ori r3, r3, 0xf0000000@l
+ mtspr MBAR, r3
rlwinm r3, r3, 16, 16, 31
-
- lis r4, CFG_DEFAULT_MBAR@h
stw r3, 0(r4)
-#endif /* CFG_DEFAULT_MBAR */
/* Initialise the MPC5xxx processor core */
/*--------------------------------------------------------------*/
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 08/14] pcm030: use new functionality
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (6 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 07/14] ppc mpc5200b: cleanup lowlevel startup Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 09/14] ppc: hardcode sdram base to 0x0 Sascha Hauer
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
We introduced several new functions to ease our life
on ppc, use themn on the pcm030:
- setup iomux and bus clocks in board code
- add sdram memory according to detected size
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/boards/pcm030/pcm030.c | 55 +++++++++++++++++----------------------
include/common.h | 2 +-
2 files changed, 25 insertions(+), 32 deletions(-)
diff --git a/arch/ppc/boards/pcm030/pcm030.c b/arch/ppc/boards/pcm030/pcm030.c
index f408c3d..d1d84d2 100644
--- a/arch/ppc/boards/pcm030/pcm030.c
+++ b/arch/ppc/boards/pcm030/pcm030.c
@@ -43,9 +43,18 @@ static struct mpc5xxx_fec_platform_data fec_info = {
static int devices_init (void)
{
- add_cfi_flash_device(-1, 0xff000000, 16 * 1024 * 1024, 0);
- add_mem_device("ram0", 0x0, 64 * 1024 * 1024,
- IORESOURCE_MEM_WRITEABLE);
+ unsigned long sdramsize;
+
+ /*
+ * Flash can be 16MB or 32MB, setup for the last 32MB no matter
+ * what we find later.
+ */
+ mpc5200_setup_cs(MPC5200_BOOTCS, 0xfe000000, SZ_32M, 0x0001dd00);
+ add_cfi_flash_device(-1, 0xfe000000, 32 * 1024 * 1024, 0);
+
+ sdramsize = mpc5200_get_sdram_size(0) + mpc5200_get_sdram_size(1);
+ barebox_add_memory_bank("ram0", 0x0, sdramsize);
+
add_generic_device("fec_mpc5xxx", -1, NULL, MPC5XXX_FEC, 0,
IORESOURCE_MEM, &fec_info);
@@ -109,19 +118,21 @@ static void sdram_start (int hi_addr)
__asm__ volatile ("sync");
}
-/*
- * ATTENTION: Although partially referenced initdram does NOT make real use
- * use of CFG_SDRAM_BASE. The code does not work if CFG_SDRAM_BASE
- * is something else than 0x00000000.
- */
-
-long int initdram (int board_type)
+void initdram (int board_type)
{
ulong dramsize = 0;
- ulong dramsize2 = 0;
ulong test1, test2;
+ /* Setup pin multiplexing */
+
+ /* PSC6=UART, PSC3=UART ; Ether=100MBit with MD */
+ *(vu_long *)MPC5XXX_GPS_PORT_CONFIG = 0x00558c10;
+ *(vu_long *)MPC5XXX_CS_BURST = 0x00000000;
+ *(vu_long *)MPC5XXX_CS_DEADCYCLE = 0x33333333;
+
+ mpc5200_setup_bus_clocks(1, 4);
+
if (get_pc() > SZ_128M) {
/* setup SDRAM chip selects */
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001b;/* 256MB at 0x0 */
@@ -141,9 +152,9 @@ long int initdram (int board_type)
/* find RAM size using SDRAM CS0 only */
sdram_start(0);
- test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x10000000);
+ test1 = get_ram_size((ulong *)0, 0x10000000);
sdram_start(1);
- test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x10000000);
+ test2 = get_ram_size((ulong *)0, 0x10000000);
if (test1 > test2) {
sdram_start(0);
dramsize = test1;
@@ -163,24 +174,6 @@ long int initdram (int board_type)
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
}
}
-
- /* retrieve size of memory connected to SDRAM CS0 */
- dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
- if (dramsize >= 0x13) {
- dramsize = (1 << (dramsize - 0x13)) << 20;
- } else {
- dramsize = 0;
- }
-
- /* retrieve size of memory connected to SDRAM CS1 */
- dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
- if (dramsize2 >= 0x13) {
- dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
- } else {
- dramsize2 = 0;
- }
-
- return dramsize + dramsize2;
}
#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
diff --git a/include/common.h b/include/common.h
index 0ce4a70..e34bbea 100644
--- a/include/common.h
+++ b/include/common.h
@@ -94,7 +94,7 @@ void __noreturn hang (void);
void __noreturn panic(const char *fmt, ...);
/* */
-long int initdram (int);
+void initdram (int);
char *size_human_readable(ulong size);
/* common/main.c */
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 09/14] ppc: hardcode sdram base to 0x0
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (7 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 08/14] pcm030: use new functionality Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 10/14] mpc5200: hardcode MBAR to 0xf0000000 Sascha Hauer
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/lib/board_data.c | 2 +-
arch/ppc/mach-mpc5xxx/cpu_init.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/ppc/lib/board_data.c b/arch/ppc/lib/board_data.c
index b28830f..ff9f0d0 100644
--- a/arch/ppc/lib/board_data.c
+++ b/arch/ppc/lib/board_data.c
@@ -4,7 +4,7 @@ int init_board_data(bd_t *bd)
{
cpu_init_board_data(bd);
- bd->bi_memstart = CFG_SDRAM_BASE; /* start of DRAM memory */
+ bd->bi_memstart = 0; /* start of DRAM memory */
// bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */ /* FIXME */
#ifdef CONFIG_IP860
diff --git a/arch/ppc/mach-mpc5xxx/cpu_init.c b/arch/ppc/mach-mpc5xxx/cpu_init.c
index bf0a5bd..021091e 100644
--- a/arch/ppc/mach-mpc5xxx/cpu_init.c
+++ b/arch/ppc/mach-mpc5xxx/cpu_init.c
@@ -142,7 +142,7 @@ int cpu_init(void)
/* Enable snooping for RAM */
*(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 15);
- *(vu_long *)(MPC5XXX_XLBARB + 0x70) = CFG_SDRAM_BASE | 0x1d;
+ *(vu_long *)(MPC5XXX_XLBARB + 0x70) = 0 | 0x1d;
# if defined(CFG_IPBSPEED_133)
/* Motorola reports IPB should better run at 133 MHz. */
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 10/14] mpc5200: hardcode MBAR to 0xf0000000
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (8 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 09/14] ppc: hardcode sdram base to 0x0 Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 11/14] mpc5200: hardcode internal sram for initram Sascha Hauer
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
We use 0xf0000000 in barebox, no need to configure this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
index 8e95dd0..cef02d8 100644
--- a/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
+++ b/arch/ppc/mach-mpc5xxx/include/mach/mpc5xxx.h
@@ -40,6 +40,8 @@
/* Exception offsets (PowerPC standard) */
#define EXC_OFF_SYS_RESET 0x0100
+#define CFG_MBAR 0xf0000000
+
/* useful macros for manipulating CSx_START/STOP */
#if defined(CONFIG_MGT5100)
#define START_REG(start) ((start) >> 15)
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 11/14] mpc5200: hardcode internal sram for initram
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (9 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 10/14] mpc5200: hardcode MBAR to 0xf0000000 Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 12/14] pcm030: fix /dev/self0 and /dev/env0 Sascha Hauer
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
Why should we use other ram? No need to configure this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/mach-mpc5xxx/start.S | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/ppc/mach-mpc5xxx/start.S b/arch/ppc/mach-mpc5xxx/start.S
index d619460..dc53c8a 100644
--- a/arch/ppc/mach-mpc5xxx/start.S
+++ b/arch/ppc/mach-mpc5xxx/start.S
@@ -102,9 +102,8 @@ setup_mbar:
/*--------------------------------------------------------------*/
/* set up stack in on-chip SRAM */
- lis r3, (CFG_INIT_RAM_ADDR + CFG_INIT_RAM_SIZE)@h
- ori r3, r3, (CFG_INIT_RAM_ADDR + CFG_INIT_RAM_SIZE)@l
- subi r1, r3, CONFIG_EARLY_INITDATA_SIZE
+ lis r1, (MPC5XXX_SRAM + MPC5XXX_SRAM_SIZE)@h
+ ori r1, r1, (MPC5XXX_SRAM + MPC5XXX_SRAM_SIZE)@l
li r0, 0 /* Make room for stack frame header and */
stwu r0, -4(r1) /* clear final stack frame so that */
stwu r0, -4(r1) /* stack backtraces terminate cleanly */
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 12/14] pcm030: fix /dev/self0 and /dev/env0
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (10 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 11/14] mpc5200: hardcode internal sram for initram Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 13/14] ppc mpc5200: remove bus clock switching from generic code Sascha Hauer
2011-09-27 8:28 ` [PATCH 14/14] pcm030: cleanup config.h Sascha Hauer
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
/dev/self0 and /dev/env0 are in the last MB of nor flash. The
offset depends on the size of the flash, so detect this at
runtime.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/boards/pcm030/pcm030.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/arch/ppc/boards/pcm030/pcm030.c b/arch/ppc/boards/pcm030/pcm030.c
index d1d84d2..61fb116 100644
--- a/arch/ppc/boards/pcm030/pcm030.c
+++ b/arch/ppc/boards/pcm030/pcm030.c
@@ -36,6 +36,8 @@
#include <partition.h>
#include <memory.h>
#include <sizes.h>
+#include <linux/stat.h>
+#include <fs.h>
static struct mpc5xxx_fec_platform_data fec_info = {
.xcv_type = MII100,
@@ -44,12 +46,14 @@ static struct mpc5xxx_fec_platform_data fec_info = {
static int devices_init (void)
{
unsigned long sdramsize;
+ struct stat s;
+ int ret;
/*
* Flash can be 16MB or 32MB, setup for the last 32MB no matter
* what we find later.
*/
- mpc5200_setup_cs(MPC5200_BOOTCS, 0xfe000000, SZ_32M, 0x0001dd00);
+ mpc5200_setup_cs(MPC5200_BOOTCS, 0xfe000000, SZ_32M, 0x0008fd00);
add_cfi_flash_device(-1, 0xfe000000, 32 * 1024 * 1024, 0);
sdramsize = mpc5200_get_sdram_size(0) + mpc5200_get_sdram_size(1);
@@ -58,8 +62,12 @@ static int devices_init (void)
add_generic_device("fec_mpc5xxx", -1, NULL, MPC5XXX_FEC, 0,
IORESOURCE_MEM, &fec_info);
- devfs_add_partition("nor0", 0x00f00000, 0x40000, PARTITION_FIXED, "self0");
- devfs_add_partition("nor0", 0x00f60000, 0x20000, PARTITION_FIXED, "env0");
+ ret = stat("/dev/nor0", &s);
+ if (ret)
+ return 0;
+
+ devfs_add_partition("nor0", s.st_size - SZ_1M, SZ_512K, PARTITION_FIXED, "self0");
+ devfs_add_partition("nor0", s.st_size - SZ_512K, SZ_512K, PARTITION_FIXED, "env0");
return 0;
}
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 13/14] ppc mpc5200: remove bus clock switching from generic code
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (11 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 12/14] pcm030: fix /dev/self0 and /dev/env0 Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
2011-09-27 8:28 ` [PATCH 14/14] pcm030: cleanup config.h Sascha Hauer
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
The only user (pcm030) already setups the bus clocks in
its board code.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/mach-mpc5xxx/cpu_init.c | 15 ---------------
1 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/arch/ppc/mach-mpc5xxx/cpu_init.c b/arch/ppc/mach-mpc5xxx/cpu_init.c
index 021091e..0c17d95 100644
--- a/arch/ppc/mach-mpc5xxx/cpu_init.c
+++ b/arch/ppc/mach-mpc5xxx/cpu_init.c
@@ -144,21 +144,6 @@ int cpu_init(void)
*(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 15);
*(vu_long *)(MPC5XXX_XLBARB + 0x70) = 0 | 0x1d;
-# if defined(CFG_IPBSPEED_133)
- /* Motorola reports IPB should better run at 133 MHz. */
- *(vu_long *)MPC5XXX_ADDECR |= 1;
- /* pci_clk_sel = 0x02, ipb_clk_sel = 0x00; */
- addecr = *(vu_long *)MPC5XXX_CDM_CFG;
- addecr &= ~0x103;
-# if defined(CFG_PCISPEED_66)
- /* pci_clk_sel = 0x01 -> IPB_CLK/2 */
- addecr |= 0x01;
-# else
- /* pci_clk_sel = 0x02 -> XLB_CLK/4 = IPB_CLK/4 */
- addecr |= 0x02;
-# endif /* CFG_PCISPEED_66 */
- *(vu_long *)MPC5XXX_CDM_CFG = addecr;
-# endif /* CFG_IPBSPEED_133 */
/* Configure the XLB Arbiter */
*(vu_long *)MPC5XXX_XLBARB_MPRIEN = 0xff;
*(vu_long *)MPC5XXX_XLBARB_MPRIVAL = 0x11111111;
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 14/14] pcm030: cleanup config.h
2011-09-27 8:28 more ppc and pcm030 cleanup Sascha Hauer
` (12 preceding siblings ...)
2011-09-27 8:28 ` [PATCH 13/14] ppc mpc5200: remove bus clock switching from generic code Sascha Hauer
@ 2011-09-27 8:28 ` Sascha Hauer
13 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2011-09-27 8:28 UTC (permalink / raw)
To: barebox
Remove several now unnecessary defines.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/ppc/boards/pcm030/config.h | 66 +-------------------------------------
1 files changed, 2 insertions(+), 64 deletions(-)
diff --git a/arch/ppc/boards/pcm030/config.h b/arch/ppc/boards/pcm030/config.h
index a772ee6..e8064d2 100644
--- a/arch/ppc/boards/pcm030/config.h
+++ b/arch/ppc/boards/pcm030/config.h
@@ -29,80 +29,18 @@
#include <mach/mpc5xxx.h>
-/* #define DEBUG */
-
-/*------------------------------------------------------------------------------------------------------------------------------------------------------
-High Level Configuration Options
-(easy to change)
- ------------------------------------------------------------------------------------------------------------------------------------------------------*/
-#define CONFIG_MPC5200_DDR 1 /* (with DDR-SDRAM) */
#define CFG_MPC5XXX_CLKIN 33333333 /* ... running at 33.333333MHz */
-#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
-#define BOOTFLAG_WARM 0x02 /* Software reboot */
-
-/*------------------------------------------------------------------------------------------------------------------------------------------------------
-Serial console configuration
- ------------------------------------------------------------------------------------------------------------------------------------------------------*/
-
-#if (TEXT_BASE == 0xFF000000) /* Boot low */
-#define CFG_LOWBOOT 1
-#endif
-/* RAMBOOT will be defined automatically in memory section */
-
-/*------------------------------------------------------------------------------------------------------------------------------------------------------
-IPB Bus clocking configuration.
- ------------------------------------------------------------------------------------------------------------------------------------------------------*/
-#define CFG_IPBSPEED_133 /* define for 133MHz speed */
-#if defined(CFG_IPBSPEED_133)
-/*
- * PCI Bus clocking configuration
- *
- * Actually a PCI Clock of 66 MHz is only set (in cpu_init.c) if
- * CFG_IPBSPEED_133 is defined. This is because a PCI Clock of 66 MHz yet hasn't
- * been tested with a IPB Bus Clock of 66 MHz.
- */
-#define CFG_PCISPEED_66 /* define for 66MHz speed */
-#else
-#undef CFG_PCISPEED_66 /* for 33MHz speed */
-#endif
-/* we only use CS-Boot */
-#define CFG_BOOTCS_START 0xFF000000
-#define CFG_BOOTCS_SIZE 0x01000000
-
-#if CONFIG_MACH_PHYCORE_MPC5200B_TINY_REV == 1
-#define CFG_BOOTCS_CFG 0x0008FD00
-#else
-#define CFG_BOOTCS_CFG 0x00083800
-#endif
-
-/*------------------------------------------------------------------------------------------------------------------------------------------------------
- Memory map
- ------------------------------------------------------------------------------------------------------------------------------------------------------*/
-#define CFG_MBAR 0xF0000000 /* MBAR hast to be switched by other bootloader or debugger config */
-#define CFG_SDRAM_BASE 0x00000000
-
-/* Use SRAM until RAM will be available */
-#define CFG_INIT_RAM_ADDR MPC5XXX_SRAM
-#define CFG_INIT_RAM_SIZE MPC5XXX_SRAM_SIZE /* End of used area in DPRAM */
-#define CONFIG_EARLY_INITDATA_SIZE 0x100
-
-#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
-
-/*------------------------------------------------------------------------------------------------------------------------------------------------------
- GPIO configuration
- ------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CFG_GPS_PORT_CONFIG 0x00558c10 /* PSC6=UART, PSC3=UART ; Ether=100MBit with MD */
-/*------------------------------------------------------------------------------------------------------------------------------------------------------
- Various low-level settings
- ------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CFG_HID0_INIT HID0_ICE | HID0_ICFI
#define CFG_HID0_FINAL HID0_ICE
#define CFG_CS_BURST 0x00000000
#define CFG_CS_DEADCYCLE 0x33333333
+#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
+
#define OF_CPU "PowerPC,5200@0"
#define OF_TBCLK CFG_MPC5XXX_CLKIN
#define OF_SOC "soc5200@f0000000"
--
1.7.6.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread