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

📄 embed_config.c

📁 linux内核源码
💻 C
📖 第 1 页 / 共 2 页
字号:
	/* Collect the bits from the scmr.	*/	pllmf = scmr & 0xf;	corecnf = (scmr >> 24) & 0x1f;	/* This is arithmetic from the 8280 manual.	*/	main_clk = clkin * (pllmf + 1);	bd->bi_cpmfreq = main_clk / 2;	/* CPM Freq, in MHz */	bd->bi_intfreq = bd->bi_busfreq * bus2core_8280[corecnf] / 2;	/* Set Baud rate divisor.  The power up default is divide by 16,	 * but we set it again here in case it was changed.	 */	ip->im_clkrst.car_sccr = (ip->im_clkrst.car_sccr & 0x3) | 0x1;	bd->bi_brgfreq = main_clk / 16;}#endif#ifdef CONFIG_SBC82xxvoidembed_config(bd_t **bdp){	u_char	*cp;	int	i;	bd_t	*bd;	unsigned long pvr;	bd = *bdp;	bd = &bdinfo;	*bdp = bd;	bd->bi_baudrate = 9600;	bd->bi_memsize = 256 * 1024 * 1024;	/* just a guess */	cp = (void*)SBC82xx_MACADDR_NVRAM_SCC1;	memcpy(bd->bi_enetaddr, cp, 6);	/* can busfreq be calculated? */	pvr = mfspr(SPRN_PVR);	if ((pvr & 0xffff0000) == 0x80820000) {		bd->bi_busfreq = 100000000;		clk_8280(bd);	} else {		bd->bi_busfreq = 66000000;		clk_8260(bd);	}}#endif /* SBC82xx */#if defined(CONFIG_EST8260) || defined(CONFIG_TQM8260)voidembed_config(bd_t **bdp){	u_char	*cp;	int	i;	bd_t	*bd;	bd = *bdp;#if 0	/* This is actually provided by my boot rom.  I have it	 * here for those people that may load the kernel with	 * a JTAG/COP tool and not the rom monitor.	 */	bd->bi_baudrate = 115200;	bd->bi_intfreq = 200000000;	bd->bi_busfreq = 66666666;	bd->bi_cpmfreq = 66666666;	bd->bi_brgfreq = 33333333;	bd->bi_memsize = 16 * 1024 * 1024;#else	/* The boot rom passes these to us in MHz.  Linux now expects	 * them to be in Hz.	 */	bd->bi_intfreq *= 1000000;	bd->bi_busfreq *= 1000000;	bd->bi_cpmfreq *= 1000000;	bd->bi_brgfreq *= 1000000;#endif	cp = (u_char *)def_enet_addr;	for (i=0; i<6; i++) {		bd->bi_enetaddr[i] = *cp++;	}}#endif /* EST8260 */#ifdef CONFIG_SBS8260voidembed_config(bd_t **bdp){	u_char	*cp;	int	i;	bd_t	*bd;	/* This should provided by the boot rom.	 */	bd = &bdinfo;	*bdp = bd;	bd->bi_baudrate = 9600;	bd->bi_memsize = 64 * 1024 * 1024;	/* Set all of the clocks.  We have to know the speed of the	 * external clock.  The development board had 66 MHz.	 */	bd->bi_busfreq = 66666666;	clk_8260(bd);	/* I don't know how to compute this yet.	*/	bd->bi_intfreq = 133000000;	cp = (u_char *)def_enet_addr;	for (i=0; i<6; i++) {		bd->bi_enetaddr[i] = *cp++;	}}#endif /* SBS8260 */#ifdef CONFIG_RPX8260voidembed_config(bd_t **bdp){	u_char	*cp, *keyvals;	int	i;	bd_t	*bd;	keyvals = (u_char *)*bdp;	bd = &bdinfo;	*bdp = bd;	/* This is almost identical to the RPX-Lite/Classic functions	 * on the 8xx boards.  It would be nice to have a key lookup	 * function in a string, but the format of all of the fields	 * is slightly different.	 */	cp = keyvals;	for (;;) {		if (*cp == 'E') {			cp++;			if (*cp == 'A') {				cp += 2;				rpx_eth(bd, cp);			}		}		if (*cp == 'S') {			cp++;			if (*cp == 'B') {				cp += 2;				bd->bi_baudrate = rpx_baseten(cp);			}		}		if (*cp == 'D') {			cp++;			if (*cp == '1') {				cp += 2;				bd->bi_memsize = rpx_baseten(cp) * 1024 * 1024;			}		}		if (*cp == 'X') {			cp++;			if (*cp == 'T') {				cp += 2;				bd->bi_busfreq = rpx_baseten(cp);			}		}		if (*cp == 'N') {			cp++;			if (*cp == 'V') {				cp += 2;				bd->bi_nvsize = rpx_baseten(cp) * 1024 * 1024;			}		}		/* Scan to the end of the record.		*/		while ((*cp != '\n') && (*cp != 0xff))			cp++;		/* If the next character is a 0 or ff, we are done.		*/		cp++;		if ((*cp == 0) || (*cp == 0xff))			break;	}	bd->bi_memstart = 0;	/* The memory size includes both the 60x and local bus DRAM.	 * I don't want to use the local bus DRAM for real memory,	 * so subtract it out.  It would be nice if they were separate	 * keys.	 */	bd->bi_memsize -= 32 * 1024 * 1024;	/* Set all of the clocks.  We have to know the speed of the	 * external clock.	 */	clk_8260(bd);	/* I don't know how to compute this yet.	*/	bd->bi_intfreq = 200000000;}#endif /* RPX6 for testing */#ifdef CONFIG_ADS8260voidembed_config(bd_t **bdp){	u_char	*cp;	int	i;	bd_t	*bd;	/* This should provided by the boot rom.	 */	bd = &bdinfo;	*bdp = bd;	bd->bi_baudrate = 9600;	bd->bi_memsize = 16 * 1024 * 1024;	/* Set all of the clocks.  We have to know the speed of the	 * external clock.  The development board had 66 MHz.	 */	bd->bi_busfreq = 66666666;	clk_8260(bd);	/* I don't know how to compute this yet.	*/	bd->bi_intfreq = 200000000;	cp = (u_char *)def_enet_addr;	for (i=0; i<6; i++) {		bd->bi_enetaddr[i] = *cp++;	}}#endif /* ADS8260 */#ifdef CONFIG_WILLOWvoidembed_config(bd_t **bdp){	u_char	*cp;	int	i;	bd_t	*bd;	/* Willow has Open Firmware....I should learn how to get this	 * information from it.	 */	bd = &bdinfo;	*bdp = bd;	bd->bi_baudrate = 9600;	bd->bi_memsize = 32 * 1024 * 1024;	/* Set all of the clocks.  We have to know the speed of the	 * external clock.  The development board had 66 MHz.	 */	bd->bi_busfreq = 66666666;	clk_8260(bd);	/* I don't know how to compute this yet.	*/	bd->bi_intfreq = 200000000;	cp = (u_char *)def_enet_addr;	for (i=0; i<6; i++) {		bd->bi_enetaddr[i] = *cp++;	}}#endif /* WILLOW */#if defined(CONFIG_XILINX_ML300) || defined(CONFIG_XILINX_ML403)voidembed_config(bd_t ** bdp){	static const unsigned long line_size = 32;	static const unsigned long congruence_classes = 256;	unsigned long addr;	unsigned long dccr;	uint8_t* cp;	bd_t *bd;	int i;	/*	 * Invalidate the data cache if the data cache is turned off.	 * - The 405 core does not invalidate the data cache on power-up	 *   or reset but does turn off the data cache. We cannot assume	 *   that the cache contents are valid.	 * - If the data cache is turned on this must have been done by	 *   a bootloader and we assume that the cache contents are	 *   valid.	 */	__asm__("mfdccr %0": "=r" (dccr));	if (dccr == 0) {		for (addr = 0;		     addr < (congruence_classes * line_size);		     addr += line_size) {			__asm__("dccci 0,%0": :"b"(addr));		}	}	bd = &bdinfo;	*bdp = bd;	bd->bi_memsize = XPAR_DDR_0_SIZE;	bd->bi_intfreq = XPAR_CORE_CLOCK_FREQ_HZ;	bd->bi_busfreq = XPAR_PLB_CLOCK_FREQ_HZ;	bd->bi_pci_busfreq = XPAR_PCI_0_CLOCK_FREQ_HZ;	/* Copy the default ethernet address */	cp = (u_char *)def_enet_addr;	for (i=0; i<6; i++)		bd->bi_enetaddr[i] = *cp++;	timebase_period_ns = 1000000000 / bd->bi_tbfreq;	/* see bi_tbfreq definition in arch/ppc/platforms/4xx/xilinx_ml300.h */}#endif /* CONFIG_XILINX_ML300 || CONFIG_XILINX_ML403 */#ifdef CONFIG_IBM_OPENBIOS/* This could possibly work for all treeboot roms.*/#if defined(CONFIG_BUBINGA)#define BOARD_INFO_VECTOR       0xFFF80B50 /* openbios 1.19 moved this vector down  - armin */#else#define BOARD_INFO_VECTOR	0xFFFE0B50#endifvoidembed_config(bd_t **bdp){	u_char	*cp;	int	i;	bd_t	*bd, *treeboot_bd;	bd_t *(*get_board_info)(void) =	    (bd_t *(*)(void))(*(unsigned long *)BOARD_INFO_VECTOR);#if !defined(CONFIG_STB03xxx)	/* shut down the Ethernet controller that the boot rom	 * sometimes leaves running.	 */	mtdcr(DCRN_MALCR(DCRN_MAL_BASE), MALCR_MMSR);     /* 1st reset MAL */	while (mfdcr(DCRN_MALCR(DCRN_MAL_BASE)) & MALCR_MMSR) {}; /* wait for the reset */		out_be32((volatile u32*)EMAC0_BASE,0x20000000);        /* then reset EMAC */#endif	bd = &bdinfo;	*bdp = bd;	if ((treeboot_bd = get_board_info()) != NULL) {		memcpy(bd, treeboot_bd, sizeof(bd_t));	}	else {		/* Hmmm...better try to stuff some defaults.		*/		bd->bi_memsize = 16 * 1024 * 1024;		cp = (u_char *)def_enet_addr;		for (i=0; i<6; i++) {			/* I should probably put different ones here,			 * hopefully only one is used.			 */			bd->BD_EMAC_ADDR(0,i) = *cp;#ifdef CONFIG_PCI			bd->bi_pci_enetaddr[i] = *cp++;#endif		}		bd->bi_tbfreq = 200 * 1000 * 1000;		bd->bi_intfreq = 200000000;		bd->bi_busfreq = 100000000;#ifdef CONFIG_PCI		bd->bi_pci_busfreq = 66666666;#endif	}	/* Yeah, this look weird, but on Redwood 4 they are	 * different object in the structure.  Sincr Redwwood 5	 * and Redwood 6 use OpenBIOS, it requires a special value.	 */#if defined(CONFIG_REDWOOD_5) || defined (CONFIG_REDWOOD_6)	bd->bi_tbfreq = 27 * 1000 * 1000;#endif	timebase_period_ns = 1000000000 / bd->bi_tbfreq;}#endif /* CONFIG_IBM_OPENBIOS */#ifdef CONFIG_EP405#include <linux/serial_reg.h>voidembed_config(bd_t **bdp){	u32 chcr0;	u_char *cp;	bd_t	*bd;	/* Different versions of the PlanetCore firmware vary in how	   they set up the serial port - in particular whether they	   use the internal or external serial clock for UART0.  Make	   sure the UART is in a known state. */	/* FIXME: We should use the board's 11.0592MHz external serial	   clock - it will be more accurate for serial rates.  For	   now, however the baud rates in ep405.h are for the internal	   clock. */	chcr0 = mfdcr(DCRN_CHCR0);	if ( (chcr0 & 0x1fff) != 0x103e ) {		mtdcr(DCRN_CHCR0, (chcr0 & 0xffffe000) | 0x103e);		/* The following tricks serial_init() into resetting the baud rate */		writeb(0, UART0_IO_BASE + UART_LCR);	}	/* We haven't seen actual problems with the EP405 leaving the	 * EMAC running (as we have on Walnut).  But the registers	 * suggest it may not be left completely quiescent.  Reset it	 * just to be sure. */	mtdcr(DCRN_MALCR(DCRN_MAL_BASE), MALCR_MMSR);     /* 1st reset MAL */	while (mfdcr(DCRN_MALCR(DCRN_MAL_BASE)) & MALCR_MMSR) {}; /* wait for the reset */		out_be32((unsigned *)EMAC0_BASE,0x20000000);        /* then reset EMAC */	bd = &bdinfo;	*bdp = bd;#if 1	        cp = (u_char *)0xF0000EE0;	        for (;;) {	                if (*cp == 'E') {	                        cp++;	                        if (*cp == 'A') {                                  cp += 2;                                  rpx_eth(bd, cp);	                        }		         }	         	if (*cp == 'D') {	                        	cp++;	                        	if (*cp == '1') {		                                cp += 2;		                                rpx_memsize(bd, cp);	        	                }                	}			if (*cp == 'N') {				cp++;				if (*cp == 'V') {					cp += 2;					rpx_nvramsize(bd, cp);				}			}			while ((*cp != '\n') && (*cp != 0xff))			      cp++;	                cp++;	                if ((*cp == 0) || (*cp == 0xff))	                   break;	       }	bd->bi_intfreq   = 200000000;	bd->bi_busfreq   = 100000000;	bd->bi_pci_busfreq= 33000000 ;#else	bd->bi_memsize   = 64000000;	bd->bi_intfreq   = 200000000;	bd->bi_busfreq   = 100000000;	bd->bi_pci_busfreq= 33000000 ;#endif}#endif

⌨️ 快捷键说明

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