[POWERPC] mpc5200: Add cuimage support for mpc5200 boards
Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
ad25a4cca7
commit
85498ae87c
|
@ -45,8 +45,8 @@ 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 oflib.c ofconsole.c \
|
||||
4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
|
||||
cpm-serial.c stdlib.c
|
||||
src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
|
||||
cpm-serial.c stdlib.c mpc52xx-psc.c
|
||||
src-plat := of.c cuboot-52xx.c cuboot-83xx.c cuboot-85xx.c holly.c \
|
||||
cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
|
||||
ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
|
||||
cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c cuboot-bamboo.c
|
||||
|
@ -143,6 +143,7 @@ image-$(CONFIG_DEFAULT_UIMAGE) += uImage
|
|||
ifneq ($(CONFIG_DEVICE_TREE),"")
|
||||
image-$(CONFIG_PPC_8xx) += cuImage.8xx
|
||||
image-$(CONFIG_8260) += cuImage.pq2
|
||||
image-$(CONFIG_PPC_MPC52xx) += cuImage.52xx
|
||||
image-$(CONFIG_PPC_83xx) += cuImage.83xx
|
||||
image-$(CONFIG_PPC_85xx) += cuImage.85xx
|
||||
image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Old U-boot compatibility for MPC5200
|
||||
*
|
||||
* Author: Grant Likely <grant.likely@secretlab.ca>
|
||||
*
|
||||
* Copyright (c) 2007 Secret Lab Technologies Ltd.
|
||||
* 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 "io.h"
|
||||
#include "cuboot.h"
|
||||
|
||||
#define TARGET_PPC_MPC52xx
|
||||
#include "ppcboot.h"
|
||||
|
||||
static bd_t bd;
|
||||
|
||||
static void platform_fixups(void)
|
||||
{
|
||||
void *soc, *reg;
|
||||
int div;
|
||||
u32 sysfreq;
|
||||
|
||||
|
||||
dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
|
||||
dt_fixup_mac_addresses(bd.bi_enetaddr);
|
||||
dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
|
||||
|
||||
/* Unfortunately, the specific model number is encoded in the
|
||||
* soc node name in existing dts files -- once that is fixed,
|
||||
* this can do a simple path lookup.
|
||||
*/
|
||||
soc = find_node_by_devtype(NULL, "soc");
|
||||
if (soc) {
|
||||
setprop(soc, "bus-frequency", &bd.bi_ipbfreq,
|
||||
sizeof(bd.bi_ipbfreq));
|
||||
|
||||
if (!dt_xlate_reg(soc, 0, (void*)®, NULL))
|
||||
return;
|
||||
div = in_8(reg + 0x204) & 0x0020 ? 8 : 4;
|
||||
sysfreq = bd.bi_busfreq * div;
|
||||
setprop(soc, "system-frequency", &sysfreq, sizeof(sysfreq));
|
||||
}
|
||||
}
|
||||
|
||||
void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
|
||||
unsigned long r6, unsigned long r7)
|
||||
{
|
||||
CUBOOT_INIT();
|
||||
ft_init(_dtb_start, _dtb_end - _dtb_start, 32);
|
||||
serial_console_init();
|
||||
platform_ops.fixups = platform_fixups;
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* MPC5200 PSC serial console support.
|
||||
*
|
||||
* Author: Grant Likely <grant.likely@secretlab.ca>
|
||||
*
|
||||
* Copyright (c) 2007 Secret Lab Technologies Ltd.
|
||||
* Copyright (c) 2007 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* It is assumed that the firmware (or the platform file) has already set
|
||||
* up the port.
|
||||
*/
|
||||
|
||||
#include "types.h"
|
||||
#include "io.h"
|
||||
#include "ops.h"
|
||||
|
||||
/* Programmable Serial Controller (PSC) status register bits */
|
||||
#define MPC52xx_PSC_SR 0x04
|
||||
#define MPC52xx_PSC_SR_RXRDY 0x0100
|
||||
#define MPC52xx_PSC_SR_RXFULL 0x0200
|
||||
#define MPC52xx_PSC_SR_TXRDY 0x0400
|
||||
#define MPC52xx_PSC_SR_TXEMP 0x0800
|
||||
|
||||
#define MPC52xx_PSC_BUFFER 0x0C
|
||||
|
||||
static void *psc;
|
||||
|
||||
static int psc_open(void)
|
||||
{
|
||||
/* Assume the firmware has already configured the PSC into
|
||||
* uart mode */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void psc_putc(unsigned char c)
|
||||
{
|
||||
while (!(in_be16(psc + MPC52xx_PSC_SR) & MPC52xx_PSC_SR_TXRDY)) ;
|
||||
out_8(psc + MPC52xx_PSC_BUFFER, c);
|
||||
}
|
||||
|
||||
static unsigned char psc_tstc(void)
|
||||
{
|
||||
return (in_be16(psc + MPC52xx_PSC_SR) & MPC52xx_PSC_SR_RXRDY) != 0;
|
||||
}
|
||||
|
||||
static unsigned char psc_getc(void)
|
||||
{
|
||||
while (!(in_be16(psc + MPC52xx_PSC_SR) & MPC52xx_PSC_SR_RXRDY)) ;
|
||||
return in_8(psc + MPC52xx_PSC_BUFFER);
|
||||
}
|
||||
|
||||
int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp)
|
||||
{
|
||||
int n;
|
||||
|
||||
/* Get the base address of the psc registers */
|
||||
n = getprop(devp, "virtual-reg", &psc, sizeof(psc));
|
||||
if (n != sizeof(psc)) {
|
||||
if (!dt_xlate_reg(devp, 0, (void *)&psc, NULL))
|
||||
return -1;
|
||||
}
|
||||
|
||||
scdp->open = psc_open;
|
||||
scdp->putc = psc_putc;
|
||||
scdp->getc = psc_getc;
|
||||
scdp->tstc = psc_tstc;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -84,6 +84,7 @@ int serial_console_init(void);
|
|||
int ns16550_console_init(void *devp, struct serial_console_data *scdp);
|
||||
int mpsc_console_init(void *devp, struct serial_console_data *scdp);
|
||||
int cpm_console_init(void *devp, struct serial_console_data *scdp);
|
||||
int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp);
|
||||
void *simple_alloc_init(char *base, unsigned long heap_size,
|
||||
unsigned long granularity, unsigned long max_allocs);
|
||||
extern void flush_cache(void *, unsigned long);
|
||||
|
|
|
@ -126,6 +126,8 @@ int serial_console_init(void)
|
|||
dt_is_compatible(devp, "fsl,cpm2-scc-uart") ||
|
||||
dt_is_compatible(devp, "fsl,cpm2-smc-uart"))
|
||||
rc = cpm_console_init(devp, &serial_cd);
|
||||
else if (dt_is_compatible(devp, "mpc5200-psc-uart"))
|
||||
rc = mpc5200_psc_console_init(devp, &serial_cd);
|
||||
|
||||
/* Add other serial console driver calls here */
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ config PPC_EFIKA
|
|||
config PPC_LITE5200
|
||||
bool "Freescale Lite5200 Eval Board"
|
||||
depends on PPC_MULTIPLATFORM && PPC32
|
||||
select WANT_DEVICE_TREE
|
||||
select PPC_MPC5200
|
||||
default n
|
||||
|
||||
|
|
Loading…
Reference in New Issue