⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpu.c.svn-base

📁 PowerPC850系列的產品開機程式uboot是linuxOS BASED的程式碼
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
/* * (C) Copyright 2000-2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this * project. * * 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 *//* * m8xx.c * * CPU specific code * * written or collected and sometimes rewritten by * Magnus Damm <damm@bitsmart.com> * * minor modifications by * Wolfgang Denk <wd@denx.de> */#include <common.h>#include <watchdog.h>#include <command.h>#include <mpc8xx.h>#include <asm/cache.h>DECLARE_GLOBAL_DATA_PTR;static char *cpu_warning = "\n         " \	"*** Warning: CPU Core has Silicon Bugs -- Check the Errata ***";#if ((defined(CONFIG_MPC86x) || defined(CONFIG_MPC855)) && \     !defined(CONFIG_MPC862))static int check_CPU (long clock, uint pvr, uint immr){	char *id_str =# if defined(CONFIG_MPC855)	"PC855";# elif defined(CONFIG_MPC860P)	"PC860P";# else	NULL;# endif	volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);	uint k, m;	char buf[32];	char pre = 'X';	char *mid = "xx";	char *suf;	/* the highest 16 bits should be 0x0050 for a 860 */	if ((pvr >> 16) != 0x0050)		return -1;	k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);	m = 0;	suf = "";	/*	 * Some boards use sockets so different CPUs can be used.	 * We have to check chip version in run time.	 */	switch (k) {	case 0x00020001: pre = 'P'; break;	case 0x00030001: break;	case 0x00120003: suf = "A"; break;	case 0x00130003: suf = "A3"; break;	case 0x00200004: suf = "B"; break;	case 0x00300004: suf = "C"; break;	case 0x00310004: suf = "C1"; m = 1; break;	case 0x00200064: mid = "SR"; suf = "B"; break;	case 0x00300065: mid = "SR"; suf = "C"; break;	case 0x00310065: mid = "SR"; suf = "C1"; m = 1; break;	case 0x05010000: suf = "D3"; m = 1; break;	case 0x05020000: suf = "D4"; m = 1; break;		/* this value is not documented anywhere */	case 0x40000000: pre = 'P'; suf = "D"; m = 1; break;		/* MPC866P/MPC866T/MPC859T/MPC859DSL/MPC852T */	case 0x08010004:		/* Rev. A.0 */		suf = "A";		/* fall through */	case 0x08000003:		/* Rev. 0.3 */		pre = 'M'; m = 1;		if (id_str == NULL)			id_str =# if defined(CONFIG_MPC852T)		"PC852T";# elif defined(CONFIG_MPC859T)		"PC859T";# elif defined(CONFIG_MPC859DSL)		"PC859DSL";# elif defined(CONFIG_MPC866T)		"PC866T";# else		"PC866x"; /* Unknown chip from MPC866 family */# endif		break;	case 0x09000000: pre = 'M'; mid = suf = ""; m = 1;		if (id_str == NULL)			id_str = "PC885"; /* 870/875/880/885 */		break;	default: suf = NULL; break;	}	if (id_str == NULL)		id_str = "PC86x";	/* Unknown 86x chip */	if (suf)		printf ("%c%s%sZPnn%s", pre, id_str, mid, suf);	else		printf ("unknown M%s (0x%08x)", id_str, k);#if defined(CFG_8xx_CPUCLK_MIN) && defined(CFG_8xx_CPUCLK_MAX)	printf (" at %s MHz [%d.%d...%d.%d MHz]\n       ",		strmhz (buf, clock),		CFG_8xx_CPUCLK_MIN / 1000000,		((CFG_8xx_CPUCLK_MIN % 1000000) + 50000) / 100000,		CFG_8xx_CPUCLK_MAX / 1000000,		((CFG_8xx_CPUCLK_MAX % 1000000) + 50000) / 100000	);#else	printf (" at %s MHz: ", strmhz (buf, clock));#endif	printf ("%u kB I-Cache %u kB D-Cache",		checkicache () >> 10,		checkdcache () >> 10	);	/* do we have a FEC (860T/P or 852/859/866/885)? */	immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;	if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {		printf (" FEC present");	}	if (!m) {		puts (cpu_warning);	}	putc ('\n');#ifdef DEBUG	if(clock != measure_gclk()) {	    printf ("clock %ldHz != %dHz\n", clock, measure_gclk());	}#endif	return 0;}#elif defined(CONFIG_MPC862)static int check_CPU (long clock, uint pvr, uint immr){	volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);	uint k, m;	char buf[32];	char pre = 'X';	char *mid = "xx";	char *suf;	/* the highest 16 bits should be 0x0050 for a 8xx */	if ((pvr >> 16) != 0x0050)		return -1;	k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);	m = 0;	switch (k) {		/* this value is not documented anywhere */	case 0x06000000: mid = "P"; suf = "0"; break;	case 0x06010001: mid = "P"; suf = "A"; m = 1; break;	case 0x07000003: mid = "P"; suf = "B"; m = 1; break;	default: suf = NULL; break;	}#ifndef CONFIG_MPC857	if (suf)		printf ("%cPC862%sZPnn%s", pre, mid, suf);	else		printf ("unknown MPC862 (0x%08x)", k);#else	if (suf)		printf ("%cPC857TZPnn%s", pre, suf); /* only 857T tested right now! */	else		printf ("unknown MPC857 (0x%08x)", k);#endif	printf (" at %s MHz:", strmhz (buf, clock));	printf (" %u kB I-Cache", checkicache () >> 10);	printf (" %u kB D-Cache", checkdcache () >> 10);	/* lets check and see if we're running on a 862T (or P?) */	immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;	if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {		printf (" FEC present");	}	if (!m) {		puts (cpu_warning);	}	putc ('\n');	return 0;}#elif defined(CONFIG_MPC823)static int check_CPU (long clock, uint pvr, uint immr){	volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);	uint k, m;	char buf[32];	char *suf;	/* the highest 16 bits should be 0x0050 for a 8xx */	if ((pvr >> 16) != 0x0050)		return -1;	k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);	m = 0;	switch (k) {		/* MPC823 */	case 0x20000000: suf = "0"; break;	case 0x20010000: suf = "0.1"; break;	case 0x20020000: suf = "Z2/3"; break;	case 0x20020001: suf = "Z3"; break;	case 0x21000000: suf = "A"; break;	case 0x21010000: suf = "B"; m = 1; break;	case 0x21010001: suf = "B2"; m = 1; break;		/* MPC823E */	case 0x24010000: suf = NULL;			puts ("PPC823EZTnnB2");			m = 1;			break;	default:			suf = NULL;			printf ("unknown MPC823 (0x%08x)", k);			break;	}	if (suf)		printf ("PPC823ZTnn%s", suf);	printf (" at %s MHz:", strmhz (buf, clock));	printf (" %u kB I-Cache", checkicache () >> 10);	printf (" %u kB D-Cache", checkdcache () >> 10);	/* lets check and see if we're running on a 860T (or P?) */	immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;	if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {		puts (" FEC present");	}	if (!m) {		puts (cpu_warning);	}	putc ('\n');	return 0;}#elif defined(CONFIG_MPC850)static int check_CPU (long clock, uint pvr, uint immr){	volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);	uint k, m;	char buf[32];	/* the highest 16 bits should be 0x0050 for a 8xx */	if ((pvr >> 16) != 0x0050)		return -1;	k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);	m = 0;	switch (k) {	case 0x20020001:		printf ("XPC850xxZT");		break;	case 0x21000065:		printf ("XPC850xxZTA");		break;	case 0x21010067:		printf ("XPC850xxZTB");		m = 1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -