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

Commit f6dfc805 authored by David Gibson's avatar David Gibson Committed by Paul Mackerras
Browse files

[POWERPC] Support for the Ebony 440GP reference board in arch/powerpc



This adds platform support code for the Ebony (440GP) evaluation
board.  This includes both code in arch/powerpc/platforms/44x for
board initialization, and zImage wrapper code to correctly tweak the
flattened device tree based on information from the firmware.  The
zImage supports both IBM OpenBIOS (aka "treeboot") and old versions of
uboot which don't support a flattened device tree.

Signed-off-by: default avatarDavid Gibson <dwg@au1.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent ea20ff5d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -214,6 +214,7 @@ config 40x
config 44x
	bool "AMCC 44x"
	select PPC_DCR_NATIVE
	select WANT_DEVICE_TREE

config E200
	bool "Freescale e200"
@@ -278,9 +279,14 @@ config PPC_OF_PLATFORM_PCI
	depends on PPC64 # not supported on 32 bits yet
	default n

config 4xx
	bool
	depends on 40x || 44x
	default y

config BOOKE
	bool
	depends on E200 || E500
	depends on E200 || E500 || 44x
	default y

config FSL_BOOKE
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright 2007 David Gibson, IBM Corporation.
 *
 * Based on earlier code:
 *   Matt Porter <mporter@kernel.crashing.org>
 *   Copyright 2002-2005 MontaVista Software Inc.
 *
 *   Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
 *   Copyright (c) 2003, 2004 Zultys Technologies
 *
 * 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 <stddef.h>
#include "types.h"
#include "string.h"
#include "stdio.h"
#include "ops.h"
#include "reg.h"
#include "dcr.h"

/* Read the 44x memory controller to get size of system memory. */
void ibm44x_fixup_memsize(void)
{
	int i;
	unsigned long memsize, bank_config;

	memsize = 0;
	for (i = 0; i < ARRAY_SIZE(sdram_bxcr); i++) {
		mtdcr(DCRN_SDRAM0_CFGADDR, sdram_bxcr[i]);
		bank_config = mfdcr(DCRN_SDRAM0_CFGDATA);

		if (bank_config & SDRAM_CONFIG_BANK_ENABLE)
			memsize += SDRAM_CONFIG_BANK_SIZE(bank_config);
	}

	dt_fixup_memory(0, memsize);
}
+16 −0
Original line number Diff line number Diff line
/*
 * PowerPC 44x related functions
 *
 * Copyright 2007 David Gibson, IBM Corporation.
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */
#ifndef _PPC_BOOT_44X_H_
#define _PPC_BOOT_44X_H_

void ibm44x_fixup_memsize(void);
void ebony_init(void *mac0, void *mac1);

#endif /* _PPC_BOOT_44X_H_ */
+15 −4
Original line number Diff line number Diff line
@@ -42,8 +42,10 @@ $(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \

src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
		ns16550.c serial.c simple_alloc.c div64.S util.S \
		gunzip_util.c elf_util.c $(zlib) devtree.c
src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c
		gunzip_util.c elf_util.c $(zlib) devtree.c \
		44x.c ebony.c
src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
		cuboot-ebony.c treeboot-ebony.c
src-boot := $(src-wlib) $(src-plat) empty.c

src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -135,6 +137,7 @@ image-$(CONFIG_DEFAULT_UIMAGE) += uImage
ifneq ($(CONFIG_DEVICE_TREE),"")
image-$(CONFIG_PPC_83xx)		+= cuImage.83xx
image-$(CONFIG_PPC_85xx)		+= cuImage.85xx
image-$(CONFIG_EBONY)			+= treeImage.ebony cuImage.ebony
endif

# For 32-bit powermacs, build the COFF and miboot images
@@ -144,7 +147,8 @@ image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot
endif

initrd-  := $(patsubst zImage%, zImage.initrd%, $(image-n) $(image-))
initrd-y := $(patsubst zImage%, zImage.initrd%, $(image-y))
initrd-y := $(patsubst zImage%, zImage.initrd%, \
		$(patsubst treeImage%, treeImage.initrd%, $(image-y)))
initrd-y := $(filter-out $(image-y), $(initrd-y))
targets	+= $(image-y) $(initrd-y)

@@ -181,6 +185,12 @@ dts = $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\
$(obj)/cuImage.%: vmlinux $(dts) $(wrapperbits)
	$(call if_changed,wrap,cuboot-$*,$(dts))

$(obj)/treeImage.%: vmlinux $(dts) $(wrapperbits)
	$(call if_changed,wrap,treeboot-$*,$(dts))

$(obj)/treeImage.initrd.%: vmlinux $(dts) $(wrapperbits)
	$(call if_changed,wrap,treeboot-$*,$(dts),,$(obj)/ramdisk.image.gz)

$(obj)/zImage:		$(addprefix $(obj)/, $(image-y))
	@rm -f $@; ln $< $@
$(obj)/zImage.initrd:	$(addprefix $(obj)/, $(initrd-y))
@@ -190,7 +200,8 @@ install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<

# anything not in $(targets)
clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.*
clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* \
	treeImage.*

# clean up files cached by wrapper
clean-kernel := vmlinux.strip vmlinux.bin
+42 −0
Original line number Diff line number Diff line
/*
 * Old U-boot compatibility for Ebony
 *
 * Author: David Gibson <david@gibson.dropbear.id.au>
 *
 * Copyright 2007 David Gibson, IBM Corporatio.
 *   Based on cuboot-83xx.c, which is:
 * Copyright (c) 2007 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 version 2 as published
 * by the Free Software Foundation.
 */

#include "ops.h"
#include "stdio.h"
#include "44x.h"

#define TARGET_44x
#include "ppcboot.h"

static bd_t bd;
extern char _end[];

BSS_STACK(4096);

void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
                   unsigned long r6, unsigned long r7)
{
	unsigned long end_of_ram = bd.bi_memstart + bd.bi_memsize;
	unsigned long avail_ram = end_of_ram - (unsigned long)_end;

	memcpy(&bd, (bd_t *)r3, sizeof(bd));
	loader_info.initrd_addr = r4;
	loader_info.initrd_size = r4 ? r5 : 0;
	loader_info.cmdline = (char *)r6;
	loader_info.cmdline_len = r7 - r6;

	simple_alloc_init(_end, avail_ram, 32, 64);

	ebony_init(&bd.bi_enetaddr, &bd.bi_enet1addr);
}
Loading